Git development
 help / color / mirror / Atom feed
* Question about removing changes from the index
@ 2009-02-06 13:57 Gustav Hållberg
  2009-02-06 14:09 ` Björn Steinbrink
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gustav Hållberg @ 2009-02-06 13:57 UTC (permalink / raw)
  To: git

I'm wondering if there's anyone who can recommend a smart way to
"reset" the index entry for individual files to the contents of HEAD,
in effect, removing any previous change between HEAD and the index
(for those files).

I'm aware that 'git gui' lets you do this (in a human-friendly way)
but I want to do this from a script (and am not concerned about the
human-friendliness, as long as it's not too programmer-unfriendly).

Thanks,
Gustav

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question about removing changes from the index
  2009-02-06 13:57 Question about removing changes from the index Gustav Hållberg
@ 2009-02-06 14:09 ` Björn Steinbrink
  2009-02-06 14:51   ` Gustav Hållberg
  2009-02-06 14:11 ` Matthieu Moy
  2009-02-06 14:14 ` Sitaram Chamarty
  2 siblings, 1 reply; 5+ messages in thread
From: Björn Steinbrink @ 2009-02-06 14:09 UTC (permalink / raw)
  To: Gustav Hållberg; +Cc: git

On 2009.02.06 14:57:35 +0100, Gustav Hållberg wrote:
> I'm wondering if there's anyone who can recommend a smart way to
> "reset" the index entry for individual files to the contents of HEAD,
> in effect, removing any previous change between HEAD and the index
> (for those files).

Believe it or not, it's "git reset" ;-)

git reset -- file

You can only reset the index entry for that file to some older version,
e.g. "git reset HEAD~5 -- file".

Björn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question about removing changes from the index
  2009-02-06 13:57 Question about removing changes from the index Gustav Hållberg
  2009-02-06 14:09 ` Björn Steinbrink
@ 2009-02-06 14:11 ` Matthieu Moy
  2009-02-06 14:14 ` Sitaram Chamarty
  2 siblings, 0 replies; 5+ messages in thread
From: Matthieu Moy @ 2009-02-06 14:11 UTC (permalink / raw)
  To: Gustav Hållberg; +Cc: git

Gustav Hållberg <gustav@gmail.com> writes:

> I'm wondering if there's anyone who can recommend a smart way to
> "reset" the index entry for individual files to the contents of HEAD,
> in effect, removing any previous change between HEAD and the index
> (for those files).

Isn't "git reset -- path" what you want? Or perhaps "git checkout HEAD
-- path" if you also want to reset the file content.

-- 
Matthieu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question about removing changes from the index
  2009-02-06 13:57 Question about removing changes from the index Gustav Hållberg
  2009-02-06 14:09 ` Björn Steinbrink
  2009-02-06 14:11 ` Matthieu Moy
@ 2009-02-06 14:14 ` Sitaram Chamarty
  2 siblings, 0 replies; 5+ messages in thread
From: Sitaram Chamarty @ 2009-02-06 14:14 UTC (permalink / raw)
  To: git

On 2009-02-06, Gustav Hållberg <gustav@gmail.com> wrote:
> I'm wondering if there's anyone who can recommend a smart way to
> "reset" the index entry for individual files to the contents of HEAD,
> in effect, removing any previous change between HEAD and the index
> (for those files).

err.. 'git reset HEAD -- file'?  The man page says "The
second form with paths is used to revert selected paths in
the index from a given commit, without moving HEAD."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question about removing changes from the index
  2009-02-06 14:09 ` Björn Steinbrink
@ 2009-02-06 14:51   ` Gustav Hållberg
  0 siblings, 0 replies; 5+ messages in thread
From: Gustav Hållberg @ 2009-02-06 14:51 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: git

Thanks everyone; I feel appropriately silly now :-)

- Gustav

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-02-06 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 13:57 Question about removing changes from the index Gustav Hållberg
2009-02-06 14:09 ` Björn Steinbrink
2009-02-06 14:51   ` Gustav Hållberg
2009-02-06 14:11 ` Matthieu Moy
2009-02-06 14:14 ` Sitaram Chamarty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox