Tuesday, June 17, 2008

Undo uncommitted changes in git

It seems that 'git revert' does not work the way that 'svn revert' does (reverting all uncommitted changes). I don't know if this is the proper way, but I 'reverted' my changes using 'git stash':


git stash
git stash clear

Update:

git reset --hard

5 comments:

Arlen said...

If you don't want to throw away all changes, just some files, try `git checkout FILES...`.

jorrel said...

@arlen Thanks for the tip!

Matt Di Pasquale said...

sweet thanks.
git checkout file.txt

worked! :)

Ahmed said...

Thanks, it worked.

temposys said...

thx. works!