Remove uncommitted changes from your working directory in GIT

  Uncategorized

There is a easy solution to remove all uncommitted changes from your working directory in GIT

git fetch origin
git reset --hard origin/master

Note: After executing this command, all uncommitted changes will be removes from your working directory. If you want to save the current work before removing all uncommitted changes, you can do:

git commit -a -m "Backup my work before reset"
git branch backup

Now your work is saved on the branch “backup” in case you decide you want to backup your work to look at it later or diff it.

Source: http://stackoverflow.com/