Once in a while when I do git pull I start getting this error: error: Untracked working tree file [some file] would be overwritten by merge.
I normally want to overwrite the local changes so I do this:
git reset --hard HEAD
git clean -f -d
git pull
This was instructed here: How do I force "git pull" to overwrite local files?
However, this method seems to erase all the untracked files. So is there a way to force git to overwrite local channges but to keep all the untracked files?
git clean -f -d
will delete untracked files, so if I understand what you're trying to do, you'll want to skip that and just do git reset --hard HEAD
followed by git pull
.
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