Git: Revert uncommitted changes

Written by
Date: 2013-01-05 15:15:15 00:00


One of the nice things about working with Git, is that you can go back to previous stages of your work easily, is like a time machine.

The easiest way, is to revert changes to files and folders, and delete added files, when you have not committed yet.

To revert uncommitted changes issue this two commands:

git reset --hard

And

git clean -fd

The first one will revert existing files but modified since last commit, and the last one will remove all files added since last commit.

You are now working when you were at your last commit.