I ran git checkout and stopped the process in the middle. Now I can't switch branches because it complains I'll overwrite local files. How do I get around this? eg
git checkout egotailer error: Your local changes to the following files would be overwritten by checkout: ...
I tried
git clean -d -x -f
but it didn't help
well, if you know that your repository is all up to date and that you have nothing outstanding to be checked in, simply reset your branch back to the HEAD.
git reset --hard HEAD
git reset --hard
should do it. HEAD is implied when you don't specify a reference.
WARNING This is the most common way to lose work in Git!!
A safer way to clean your directory is
git stash -u
or
git stash --include-untracked
This will do what git reset --hard does but you can't accidentally lose information. It is only available as of version 1.7.7. Before that you had to
git add -A && git stash
for the same effect.
Later, if you realize you are missing important work, you can get it back from the stash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With