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:
- Changed a file and used
git add ., or git add .
What you want:
Remove the file from the index, but keep it versioned and left with uncommitted changes in working copy:
git reset head
Reset the file to the last state from HEAD, undoing changes and removing them from the index:
# Think `svn revert ` IIRC.
git reset HEAD
git checkout
# If you have a `` named like ``, use:
git checkout --
This is needed since git reset --hard HEAD won't work with single files.
Remove from index and versioning, keeping the un-versioned file with changes in working copy:
git rm --cached
Remove from working copy and versioning completely:
git rm