rogerxu / git-tips

Tips for Git
Apache License 2.0
2 stars 3 forks source link

git reset --hard HEAD leaves untracked files behind #2

Closed rogerxu closed 8 years ago

rogerxu commented 8 years ago

When I run git reset --hard HEAD, it's supposed to reset to a pristine version of what you pulled, as I understand it. Unfortunately, it leaves files lying around, as a git status shows a big list of untracked files.

How do you tell git "Just bring it back to EXACTLY what was in the last pull, nothing more, nothing less"?

rogerxu commented 8 years ago

git clean - Remove untracked files from the working tree

git clean -f -d