Shelve extension

Bill Barry after.fallout at gmail.com
Mon Feb 23 12:57:49 CST 2009


Peter Hosey wrote:
> On Feb 23, 2009, at 10:11:30, Bill Barry wrote:
>> this confusing thing called the "index" (I have been trying to 
>> understand what exactly it is for a month now and I still feel like 
>> I've gotten nowhere except further confused)
>
> It's your next commit. Git separates this from the working copy; 
> instead of committing what's in your working copy, you add changes to 
> the index, then commit what's there.
>
> The index is really good for being able to commit separate changes as 
> separate commits (the mixed-working-copy problem). Not only do you 
> have interactive hunk selection (the record extension in hg; add -i in 
> Git), but you don't have to commit them in the same operation like you 
> do with hg record—instead, Git saves those selections in the index. 
> You have all the time in the world to review the changes, add changes, 
> remove changes (not interactively, unfortunately), review again, etc. 
> until you commit.
>
> So you can, for example:
>
> 1. Add some changes to the index.
> 2. Go for lunch.
> 3. Review the index and working copy.
> 4. Find that you missed a change that should be in the index.
> 5. Add that.
> 6. Refill your coffee/tea/soda/water container.
> 7. Commit the index.
> 8. Review the working copy.
> 9. Add the rest of the changes.
> 10. Commit #2.
>
> I'm certainly not a frequent Git user, but I do think the index is its 
> most important contribution to the field of version control.
>
>
When you put a change in the index, is it still in your working copy?

if so then how is that different than:
1. hg qrecord mypatch
2. go for lunch
3. review mypatch and the working copy (hg qdiff?)
4. find that you missed a change that should be in your patch
5.fold the additional fix into mypatch (hg qrecord fix, hg shelve, hg 
qpop, hg qpop, hg qfold mypatch fix, hg qpush, hg unshelve)
6. refill your coffee
7. hg qfinish
8. review the working copy
9. hg ci (commit #2)

Other than that I have no idea where the stuff that is in the index is 
actually at (here I know it is at .hg/patches/mypatch and I can share it)?


More information about the Mercurial mailing list