git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* understanding index
@ 2009-01-31 11:10 Nicolas Sebrecht
  2009-01-31 12:09 ` Santi Béjar
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Sebrecht @ 2009-01-31 11:10 UTC (permalink / raw)
  To: git


Hey list.

I'm having some understanding trouble with git index. As I understand,
'git rm --cached' is not strictly the opposite of 'git add'. It's a
little embarrassing in this particular case : what if you want to
commit and did a wrong 'git add -u' command ?

Here's a minimalist sample :

% ls
foo	bar

[ hack, hack, hack on both files ]

% git status
[...]
	modified: foo
	modified: bar
[...]
% git add -u foo bar

[ optional hack on foo ]
[ damn, you realize you don't want to commit changes on foo at all ]

% git rm --cached foo
% git status
[...]
	deleted: foo
	modified: bar
[...]

If committed as is, foo will be marked as deleted (in 'git log
--name-status' at least, which is not wanted).

How to retrieve the state before the wrong 'git add -u' command _and_
keep the working tree as well (including last hacks) ? Is there any
command which is the exact opposite of 'git add -u' ?

Cheers,

-- 
Nicolas Sebrecht

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

end of thread, other threads:[~2009-01-31 22:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-31 11:10 understanding index Nicolas Sebrecht
2009-01-31 12:09 ` Santi Béjar
2009-01-31 14:45   ` Alex Riesen
     [not found]   ` <20090131124022.GB29748@ultras>
2009-01-31 20:19     ` Nicolas Sebrecht
2009-01-31 20:57       ` Santi Béjar
     [not found]         ` <20090131210939.GD29748@ultras>
2009-01-31 22:07           ` Nicolas Sebrecht
2009-01-31 21:18       ` Björn Steinbrink

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).