1

I have a modified file on the master branch.

I do a git checkout myfile, check git status and the master branch is up-to-date with no modified files.

But when I checkout another branch and come back with git checkout master the modified file shows up again. I don´t know why, I even cleaned the stash, but still, whenever I switch back to master, that file shows up as modified again.

Anyone a hint how to solve that?

3
  • 2
    what kind of difference of file do you see? Maybe one branch has line endings normalization and other not. Commented Nov 21, 2017 at 20:06
  • BTW proper command is: git checkout -- filename Commented Nov 21, 2017 at 20:10
  • no, it´not about line endings. it´s real changes. Commented Nov 21, 2017 at 21:06

1 Answer 1

1

Check if you have any .gitattributes which could declare a smudge content filter driver: that would be a script executed automatically on checkout, which could modify a file (or files).

Try also a git reset --hard, before checkout branch/checkout master, to see if the issue persists.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, just read this too late. I could solve it by deleting my local copy and cloning the repo again. The problem did not come up again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.