Sometimes when switching branches using Git (version 1.7.2.1) it does not seem to remove the files/directories I created specific to the branch I switched away from. Neither does it list it as untracked when running git status
or any log entries for those files.
This only happens occasionally and I'm not sure why or how to reset it so the files not belonging to the current branch gets deleted. If I delete the files manually, it gets in sync again (as in gets deleted/revived when switching branch).
Anyone experienced this?
When you switch branches, files that are not tracked by Git will remain untouched. Since Git does not know about new_file. dat , it will not just delete it. The file new_file.
Take away: changing branches does not touch/change/remove untracked or checked in files. Remember that the working directory and index are not 'cleared' before the branch content is loaded into it!
I have seen this too. I usually just do a git reset --hard
followed by a git clean -f -d
and it usually does the trick.
It seems to definitely happen the most often when my IDE has a lock on one of the files in the branch i'm switching from.
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