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

Re: Need help migrating workflow from svn to git.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 15, 2017, 16:33 UTC
Message-ID
<xmqqvah8q7cg.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171214130933.GA18542@raven.inka.de>
Josef Wolf <jw@raven.inka.de> writes:
Show 6 quoted lines
> With git, by contrast, this won't work. Git will refuse to pull anything as
> long as there are ANY local modifications. The cron job would need to
>
>    git stash
>    git pull
>    git stash pop

I'd assume that this "pull" is expected to be fast-forward, as otherwise you have no way of dealing with conflicted merges.

Show 9 quoted lines
> But this will temporarily remove my local modifications. If I happen to do
> a test run at this time, the test run would NOT contain the local
> modifications which I was about to test. Even worse: if I happen to save
> one of the modified files while the modifications are in the stash, the
> "git stash pop" will definitely cause a conflict, although nothing really
> changed.
>
> So, how would I get this workflow with git? Is it possible to emulate the
> behavior of "svn update"?

You do not mind a temporary inconsistency while "svn update" runs (it starts to update a file you may have local changes, but your test may run while the update is in the middle of it). So perhaps something along the lines of this would help. Assuming

    <remote> <branch>: the branch at the remote you are pulling from
    <master>: whatever branch you are using
are in your three-command example above:
    $ git fetch <remote> <branch>
    $ git checkout -m -B <master> FETCH_HEAD
should give you pretty-much identical result as
    $ git stash && git pull --ff-only && git stash pop
including a possible merge conflicts at 'git stash pop' stage.
Previous: Igor DjordjevicNext: Igor Djordjevic
Message 9 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.