Git has commands for every action imaginable, but it needs extensive knowledge to get things right and because of that it is counter-intuitive at best...
What you did before:
git add .
, or git add <file>
.What you want:
Remove the file from the index, but keep it versioned and left with uncommitted changes in working copy:
git reset HEAD <file>
Reset the file to the last state from HEAD, undoing changes and removing them from the index:
# Think `svn revert <file>` IIRC.
git reset HEAD <file>
git checkout <file>
# If you have a `<branch>` named like `<file>`, use:
git checkout -- <file>
This is needed since git reset --hard HEAD
won't work with single files.
Remove <file>
from index and versioning, keeping the un-versioned file with changes in working copy:
git rm --cached <file>
Remove <file>
from working copy and versioning completely:
git rm <file>