Reputation: 230038
When I do git revert via TortoiseGit, I get this lovely window :
However, when I want to do the same from the command line, the documentation manages to completely confuse me. How do I revert all local uncomitted changes?
Upvotes: 34
Views: 43142
Reputation: 31
Git newbies like me should be aware that working directory' != pwd
.
It rather means the whole tree.
So I'm thankful for Williams recommendation to use:
$ git stash save 'Some changes'
which can be undone via the following:
$ git stash pop
Upvotes: 2
Reputation: 5858
Assuming you haven't committed yet, you can also:
git checkout filename(s)
Upvotes: 20
Reputation: 212248
To discard all local changes, you do not use revert. revert is for reverting commits. Instead, do:
$ git reset --hard
Of course, if you are like me, 7 microseconds after you enter that command you will remember something that you wish you hadn't just deleted, so you might instead prefer to use:
$ git stash save 'Some changes'
which discards the changes from the working directory, but makes them retrievable.
Upvotes: 77