I have a tracked file (an old versioned file) that i modified on master branch.
The staus on master branch shows this file as modified but
The status on the topic branch also shows this file as modified.
Earlier there was an error “error: You have local changes to “X”; cannot switch branches” when i checkout to the other branch without doing a stash or without using “-f” in git-checkout.
i have checked “stackoverflow.com/questions/1304626/git-switch-branch-and-ignore-any-changes-without-committing” but that error doesnt occur and am able to checkout even when i have local changes.
Is there any kind of config that is causing this confusion?
It looks like the branch you’re switching to is in the same state as the branch you’re coming from. Each branch is a pointer on a tree of commits. Therefore, if two branches point to the same set of commits , you can switch between them without checking in local changes. The reason is that until you actually commit the changes, it does not make a difference to git which branch you commit them to. However, once you have commit the change, then one branch has it and the other one does not and their histories are now different.