From: Nicolas Sebrecht Date: Sat, 31 Jan 2009 11:10:11 GMT Subject: understanding index Message-ID: <20090131111011.GA29748@ultras> 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