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

Re: pull into dirty working tree

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Jun 13, 2007, 22:01 UTC
Message-ID
<86k5u7zf7x.fsf@blue.stonehenge.com>
In-Reply-To
<20070613213931.GD3412@steel.home>
>>>>> "Alex" == Alex Riesen <raa.lkml@gmail.com> writes:

Alex> You left the process of figuring out what files should be temporarily Alex> added to the index. _Automatically_. Because that's what you need if Alex> you want "git pull" to just work. Otherwise it just fails.

I'd just commit *all* of it in my scenerio. There won't be any *other* files. And because of the final git-reset --soft and git-reset, it won't matter if I commited more than I'd ever commit on the final hit.

The result of my sequence (I believe) is that my topic commits will appear rebased on top of the new upstream, and that I'll have a dirty working directory that represents things as they were, ready for the next commit.

I *lose* the idea of what files were partially added before the last commit, but I can always reconstruct that by hand, because I should already be thinking about that before the next commit.

Using those famous trees, if I start with:
A--B--C--D origin
         --E--F--G my_topic
                 --(X) dirty tree
and upstream commits P Q R, the result will be:
A--B--C--D--P--Q--R origin
                  --E'--F'--G' (E, F, G rebased and merged) my_topic
                            --(X') dirty tree rebased

This works because I temporarily make H, which follows E, F, G and then rebase E-F-G-H onto origin, and then simply "uncommit" H'.

Oops. I see the problem. I don't need the "WIP" tag. I want to uncommit to G' not to G. Is that what you were referencing?

In which case, it's even simpler:

git-add . # add *everything* that's not .gitignored git-commit -a -m WIP # save for replay (H above) git-fetch origin # get upstream (P Q R) git-rebase origin # creates E' F' G' H' git-reset --soft HEAD^ # back up to G' git-reset # mark everything un-added as of G'

Yeah, this is far easier.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Previous: Alex RiesenNext: Alex Riesen
Message 13 of 35 in “pull into dirty working tree”
  1. Bill LearJun 13, 2007
  2. Pierre HabouzitJun 13, 2007
  3. Pierre HabouzitJun 13, 2007
  4. Pierre HabouzitJun 13, 2007
  5. Bill LearJun 13, 2007
  6. Pierre HabouzitJun 13, 2007
  7. Randal L. SchwartzJun 13, 2007
  8. Alex RiesenJun 13, 2007
  9. Randal L. SchwartzJun 13, 2007
  10. Alex RiesenJun 13, 2007
  11. Randal L. SchwartzJun 13, 2007
  12. Alex RiesenJun 13, 2007
  13. Randal L. SchwartzJun 13, 2007
  14. Alex RiesenJun 13, 2007
  15. Johannes SchindelinJun 13, 2007
  16. Andy ParkinsJun 13, 2007
  17. Johannes SchindelinJun 13, 2007
  18. Bill LearJun 13, 2007
  19. Johannes SchindelinJun 13, 2007
  20. Bill LearJun 13, 2007
  21. Junio C HamanoJun 13, 2007
  22. Daniel BarkalowJun 14, 2007
  23. Linus TorvaldsJun 14, 2007
  24. Junio C HamanoJun 14, 2007
  25. Raimund BauerJun 14, 2007
  26. Steven GrimmJun 14, 2007
  27. Nicolas PitreJun 14, 2007
  28. Bill LearJun 14, 2007
  29. Linus TorvaldsJun 14, 2007
  30. Olivier GalibertJun 14, 2007
  31. Linus TorvaldsJun 14, 2007
  32. Martin LanghoffJun 15, 2007
  33. Linus TorvaldsJun 15, 2007
  34. Martin LanghoffJun 15, 2007
  35. Robin RosenbergJun 15, 2007

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.