Subject: Re: pull into dirty working tree

From: [email-masked] (Randal L. Schwartz)
Date: Wed, 13 Jun 2007 15:01:22 -0700

>>>>> "Alex" == Alex Riesen <[email-masked]> 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
<[email-masked]> <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!