Last Updated: February 25, 2016
·
459
· sensae

Want to nuke your local changes and check HEAD back out?

There are plenty of reasons to want to overwrite your local changes to a git repository and check out a clean copy of HEAD. To do that, just issue this command.

git add .; git reset --hard HEAD

The git add . command makes git aware of any new files that have been created, and the subsequent command tells git to discard all of it.

1 Response
Add your response

clever...never used it with git add . I typically reset and then remove new files

over 1 year ago ·