Why does `git reset --hard HEAD~X` leave untracked files behind?

Viewed 1614

From git reset --hard HEAD leaves untracked files behind:

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"?

To get rid of these files I have to run git clean -df.

Can somebody please explain why it works this way and which files will become untracked?

2 Answers
Related