Reputation: 203
I'm always using git checkout <file>
to unstage uncommited changes, however I can't seem to do this when files were renamed.
git just can't pickup the file I want to unstaged, tried this with no luck:
git checkout <oldfilename>
and
git checkout <newfilename>
returns error: pathspec '<file>' did not match any file(s) known to git.
Upvotes: 10
Views: 5000
Reputation: 20359
Use git reset -- newfilename
to unstage the renamed file.
If instead of unstaging you are looking to rename the file back, use git mv newfilename oldfilename
.
Upvotes: 15