Thanks for your answer, Randall,

On Thu, Dec 14, 2017 at 04:07:15PM -0500, Randall S. Becker wrote:
> 
> You might want to consider a slight modification to your approach as
> follows. 
> Instead of using git pull, use git fetch.
> Have each system on its own branch (sys1 = my-sys1-branch, for example) so
> you can track who has what.
> In your scripts, consider:
> git fetch
> if nothing changed, done
> git status
> if no changes, git merge --ff  master && git push origin my-sys1-branch &&
> done
> if changes, send an email whining about the changes
> your script could then (depending on your environment) git commit -a && git
> merge && git push origin my-sys1-branch && done

The scripts never commit. In fact, they only have read access to the remote
repository. Commits are only ever done by humans manually.

So it's going to be something like this:

  git fetch origin
  if [ git diff -s master origin/master ]
    git stash
    git merge -ff master
    git stash pop
  fi

Unfortunately, the return code of git-diff don't seem to indicate whether they
have diverged. And git-status don't seem to have an option to specify "remote
is ahead of me". How would I properly check whether a merge is actually needed?

-- 
Josef Wolf
j...@raven.inka.de

Reply via email to