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

Re: Need help migrating workflow from svn to git.

From
IDIgor Djordjevic <igor.d.djordjevic@gmail.com>
Date
Dec 15, 2017, 18:24 UTC
Message-ID
<0c0867d8-73d7-3577-be26-2a9a7691d58b@gmail.com>
In-Reply-To
<20171215124739.GC18542@raven.inka.de>
Hi Josef,

Thank you for your patient answers. From what you said here and in that other reply[1], it looks like you know what you`re doing, you`re aware of circumstances, and you still prefer doing it that way.

So, here it goes... :)
On 15/12/2017 13:47, Josef Wolf wrote:
Show 8 quoted lines
> 
> > I`m thinking of a workflow involving (scripted) creation of a 
> > temporary branch at fetched remote branch position, and using 
> > something like `git checkout --merge <temp_branch>` to merge your 
> > local modifications to latest changes fetched from remote (ending
> > up with conflicts inside working tree, if any),
> 
> But this would require local modifications to be committed?
 
Nope :) Here`s a script you can test to see if it works for you, 
simulating `svn update` (at least how I perceived it).

Feel free to adapt as you feel like it (I used local "master" branch and remote "origin/master", for example), or to speak up if any additional info is needed.

    git checkout -b temp &&               #1
    git fetch &&                          #2
    git branch -f master origin/master && #3
    git checkout -m master &&             #4
    git add -u &&                         #5
    git reset &&                          #6
    git branch -d temp                    #7
Explanation:
 1. Create temporary branch where we are, switching to it, so we can 
    update "master" without local modifications
 2. Fetch latest updates
 3. Update "master" to fetched "origin/master"
 4. Switch to updated "master", merging local modifications
 5. Mark any pending merge conflicts as resolved by staging them...
 6. ... and unstage them right away
 7. Delete temporary branch

Step (4) is what merges your local modifications with remote updates (leaving conflicts, if any), where steps (5) and (6) are not needed for a single run, but in case you don`t resolve conflicts before next cron job executes this script again, step (1) will now fail without them because of (still) unresolved merge conflicts.

So, as you seem to be pretty at ease with your flow, you might prefer leaving those two steps (5, 6) in.

This does seem ugly and hacky, but if it works for you, I don`t judge :) Please note that there might be better ways to accomplish this, I repeat, I`m not an expert, but hopefully this could do the job.

Also, if I missed something, I hope someone will correct me.
Regards, Buga
[1] https://public-inbox.org/git/20171215130645.GD18542@raven.inka.de/
Previous: Josef WolfNext: Junio C Hamano
Message 8 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.