{"thread":{"id":"43646","subject":"Re: [PATCH] Added description for reversing git-update-index using --index-info","startedAt":"2006-11-02T11:13:01Z","lastAt":"2006-11-03T08:21:52Z","messageCount":3,"participants":["Andy Parkins","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"296858","messageId":"200611021113.01812.andyparkins@gmail.com","threadId":"43646","inReplyTo":null,"subject":"[PATCH] Added description for reversing git-update-index using --index-info","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-11-02T11:13:01Z","receivedAt":"2006-11-02T11:13:01Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"I wanted to restore a single file from HEAD back to the index; Shawn Pearce\ngave me the answer.  git-ls-tree piped to git-update-index --index-info.\n\nThis patch adds that answer to the git-update-index documentation.\n\nSigned-off-by: Andy Parkins <andyparkins@gmail.com>\n---\n Documentation/git-update-index.txt |   18 ++++++++++++++++++\n 1 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt\nindex 41bb7e1..5adf717 100644\n--- a/Documentation/git-update-index.txt\n+++ b/Documentation/git-update-index.txt\n@@ -215,6 +215,24 @@ for that path.  After the above, we woul\n 100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2\tfrotz\n ------------\n \n+One particular use of --index-info is to reverse the effect of\n+\"git-update-index frotz\":\n+\n+------------\n+git ls-tree HEAD frotz | git update-index --index-info\n+------------\n+\n+This makes the index hold the file frotz from HEAD rather than from the\n+working copy.  Similarly:\n+\n+------------\n+git ls-tree -r HEAD | git update-index --index-info\n+------------\n+\n+Will undo everything except \"git add\" from the index, as\n+\"git-ls-tree -r\" lists everything in the last commit.\n+\n+\n \n Using \"assume unchanged\" bit\n ----------------------------\n-- \n1.4.3.2\n"},{"id":"298571","messageId":"7vfyd1mew3.fsf@assigned-by-dhcp.cox.net","threadId":"43646","inReplyTo":"200611021113.01812.andyparkins@gmail.com","subject":"Re: [PATCH] Added description for reversing git-update-index using --index-info","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-03T02:40:28Z","receivedAt":"2006-11-03T02:40:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> writes:\n\n> +One particular use of --index-info is to reverse the effect of\n> +\"git-update-index frotz\":\n> +\n> +------------\n> +git ls-tree HEAD frotz | git update-index --index-info\n> +------------\n> +\n> +This makes the index hold the file frotz from HEAD rather than from the\n> +working copy.\n\nUp to this point is good, but I am unhappy about the next example.\n\n> +------------\n> +git ls-tree -r HEAD | git update-index --index-info\n> +------------\n> +\n> +Will undo everything except \"git add\" from the index, as\n> +\"git-ls-tree -r\" lists everything in the last commit.\n\nWhile this is correct in the mechanical sense, it _sucks_ as an\nexample, especially since you do not mention that the user would\nmost likely need to do 'git update-index --refresh' afterwards\nto make the result useful.\n"},{"id":"296272","messageId":"200611030821.54350.andyparkins@gmail.com","threadId":"43646","inReplyTo":"7vfyd1mew3.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Added description for reversing git-update-index using --index-info","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-11-03T08:21:52Z","receivedAt":"2006-11-03T08:21:52Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2006 November 03 02:40, Junio C Hamano wrote:\n\n> > +git ls-tree -r HEAD | git update-index --index-info\n>\n> While this is correct in the mechanical sense, it _sucks_ as an\n> example, especially since you do not mention that the user would\n> most likely need to do 'git update-index --refresh' afterwards\n> to make the result useful.\n\nI'm happy to ditch it if you wish; I included it only because it was one of \nthe examples that Shawn gave me in my original question.\n\nWould you like a new patch?\n\n\nAndy\n\n-- \nDr Andy Parkins, M Eng (hons), MIEE\n"}]}