tags:

views:

44

answers:

1

Say you just want to get rid of the changes you've made to one file, and get back to whatever is in the repository. I used to do this in svn:

rm a-file.txt
svn update a-file.txt

What is the equivalent in Git? I know how to fetch/pull evrything from the repository, but how about one single file?

+2  A: 

To undo your (uncommitted) changes:

git checkout a-file.txt

If you have committed changes and want to undo them back to a certain previous commit:

git checkout [some-older-commit-ref] a-file.txt

Btw, with Subversion you should have done:

svn revert a-file.txt
Martin