* [PATCH] Added description for reversing git-update-index using --index-info
@ 2006-11-02 11:13 Andy Parkins
2006-11-03 2:40 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Andy Parkins @ 2006-11-02 11:13 UTC (permalink / raw)
To: git
I wanted to restore a single file from HEAD back to the index; Shawn Pearce
gave me the answer. git-ls-tree piped to git-update-index --index-info.
This patch adds that answer to the git-update-index documentation.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
Documentation/git-update-index.txt | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index 41bb7e1..5adf717 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -215,6 +215,24 @@ for that path. After the above, we woul
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz
------------
+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. Similarly:
+
+------------
+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.
+
+
Using "assume unchanged" bit
----------------------------
--
1.4.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Added description for reversing git-update-index using --index-info
2006-11-02 11:13 [PATCH] Added description for reversing git-update-index using --index-info Andy Parkins
@ 2006-11-03 2:40 ` Junio C Hamano
2006-11-03 8:21 ` Andy Parkins
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-11-03 2:40 UTC (permalink / raw)
To: Andy Parkins; +Cc: git
Andy Parkins <andyparkins@gmail.com> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Added description for reversing git-update-index using --index-info
2006-11-03 2:40 ` Junio C Hamano
@ 2006-11-03 8:21 ` Andy Parkins
0 siblings, 0 replies; 3+ messages in thread
From: Andy Parkins @ 2006-11-03 8:21 UTC (permalink / raw)
To: git
On Friday 2006 November 03 02:40, Junio C Hamano wrote:
> > +git ls-tree -r HEAD | git update-index --index-info
>
> 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.
I'm happy to ditch it if you wish; I included it only because it was one of
the examples that Shawn gave me in my original question.
Would you like a new patch?
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-03 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02 11:13 [PATCH] Added description for reversing git-update-index using --index-info Andy Parkins
2006-11-03 2:40 ` Junio C Hamano
2006-11-03 8:21 ` Andy Parkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).