git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Need help migrating workflow from svn to git.

From
JWJosef Wolf <jw@raven.inka.de>
Date
Dec 15, 2017, 10:27 UTC
Message-ID
<20171215102759.GB18542@raven.inka.de>
In-Reply-To
<005801d3751f$859f6c50$90de44f0$@nexbridge.com>
Thanks for your answer, Randall,
On Thu, Dec 14, 2017 at 04:07:15PM -0500, Randall S. Becker wrote:
Show 15 quoted lines
> 
> 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
jw@raven.inka.de
Previous: Randall S. BeckerNext: Igor Djordjevic
Message 3 of 16 in “Need help migrating workflow from svn to git.”
  1. Josef WolfDec 14, 2017
  2. Randall S. BeckerDec 14, 2017
  3. Josef WolfDec 15, 2017
  4. Igor DjordjevicDec 14, 2017
  5. Igor DjordjevicDec 15, 2017
  6. Josef WolfDec 15, 2017
  7. Josef WolfDec 15, 2017
  8. Igor DjordjevicDec 15, 2017
  9. Junio C HamanoDec 15, 2017
  10. Igor DjordjevicDec 15, 2017
  11. Junio C HamanoDec 15, 2017
  12. Igor DjordjevicDec 15, 2017
  13. Josef WolfDec 20, 2017
  14. Josef WolfDec 20, 2017
  15. Josef WolfDec 20, 2017
  16. Igor DjordjevicDec 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.