Consider these commands:
# create file myfile.txt
git add myfile.txt
git commit myfile.txt # sha = SHA1
# modify myfile.txt
git status # shows myfile.txt modified
git branch branch2
git checkout branch2 # myfile is not replaced
git status # shows myfile.txt modified
git add myfile.txt
git commit myfile.txt
git checkout master # myfile is replaced
git status # nothing to commit, working directory clean
# myfile.txt is back to original state SHA1
When branch2 is checked out, the working directory copy of myfile.txt is not modified. However when master is checked out, the working directory copy of myfile.txt is modified, it is replaced with that from the repo.
Is this inconsistent behavior? If not, what is the "mental model" to use that explains it?