From: Junio C Hamano Date: Fri, 03 Nov 2006 02:40:28 GMT Subject: Re: [PATCH] Added description for reversing git-update-index using --index-info Message-ID: <7vfyd1mew3.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <200611021113.01812.andyparkins@gmail.com> Andy Parkins writes: > +One particular use of --index-info is to reverse the effect of > +"git-update-index frotz": > + > +------------ > +git ls-tree HEAD frotz | git update-index --index-info > +------------ > + > +This makes the index hold the file frotz from HEAD rather than from the > +working copy. Up to this point is good, but I am unhappy about the next example. > +------------ > +git ls-tree -r HEAD | git update-index --index-info > +------------ > + > +Will undo everything except "git add" from the index, as > +"git-ls-tree -r" lists everything in the last commit. While this is correct in the mechanical sense, it _sucks_ as an example, especially since you do not mention that the user would most likely need to do 'git update-index --refresh' afterwards to make the result useful.