Skip to content

Instantly share code, notes, and snippets.

@nabinno
Created July 24, 2014 14:20
Show Gist options
  • Save nabinno/383c41c6f86f3f3c2158 to your computer and use it in GitHub Desktop.
Save nabinno/383c41c6f86f3f3c2158 to your computer and use it in GitHub Desktop.
command line - git undo all commited changes / Stack Overflow http://stackoverflow.com/questions/14075581/git-undo-all-uncommitted-changes
# This will unstage all files you might have staged with git add:
git reset
# This will revert all local uncommitted changes (should be executed in repo root):
git checkout .
# You can also revert uncommitted changes only to particular file or directory:
git checkout [some_dir|file.txt]
# Yet another way to revert all uncommitted changes (longer to type, but works from any subdirectory):
git reset --hard HEAD
# This will remove all local untracked files, so only git tracked files remain:
git clean -fdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment