I have two branches in my local git repository: master
and anotherbranch
. When I switch from master
to anotherbranch
with git checkout anotherbranch
and run git status
I see modified files.
I undo these modifications with git reset HEAD
and then git status
does not display them. However when I switch to master and switch to the branch afterwards I see these modified files again.
Could you please explain what is going on?
You wouldn't have
autocrlf
set to true, by any chance?Because it can change your files on a checkout...
See the thread "core.autocrlf considered half-assed":
The git reset --hard will remove the modification from the index. Try with this additional argument it should be OK after that.
If the items are not tracked in either branch, the files will show up in
git status
asuntracked
, and will survive across checkouts