Occasionally when a pull fails and I end up with dozens of untracked files. These files appear to be all the files changed after the last pull. eg:
$:/var/django/freshplum$ sudo git pull
Updating acb962a..eaf8c43
error: Your local changes to 'plum/api/resources/product.py' would be overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.
$:/var/django/freshplum$ git status
# On branch master
# Your branch is behind 'origin/master' by 140 commits, and can be fast-forwarded.
#
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: plum/api/resources/feed.py
... dozens of files ...
# modified: plum/www/views.py
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# plum/bacon/tests/models/segment.py
... dozens of files ...
# plum/www/templates/www/internship.html
no changes added to commit (use "git add" and/or "git commit -a")
I can solve this problem with:
git reset --hard HEAD
git clean -f -d
git pull
What's the best way to resolve this situation?