Why would git treat three of my branches as if they are the same branch? [closed]

I created a branch A off of master a few months ago, and added a statement s1 to a file, but didn't commit anything. Today I checked out master, pulled, and created a new branch B. I added a statement s2 to the same file, then when testing it found that the uncommitted statement s1 from branch A was still showing up as an uncommitted change. Still not having committed or stashed any changes, I switched back to master and found that both statements s1 and s2 were still there as uncommitted changes (when presumably I should have gotten a complaint to either commit or stash changes). Similarly, switching to branch A still showed both statements s1 and s2 as uncommitted changes. Switching to older branches produced the expected complaint to either commit or stash changes, however. It seems like git is treating branches A, B, and master all as a single branch...why would this be?

Jun 18, 2025 - 07:30
 0

I created a branch A off of master a few months ago, and added a statement s1 to a file, but didn't commit anything. Today I checked out master, pulled, and created a new branch B. I added a statement s2 to the same file, then when testing it found that the uncommitted statement s1 from branch A was still showing up as an uncommitted change. Still not having committed or stashed any changes, I switched back to master and found that both statements s1 and s2 were still there as uncommitted changes (when presumably I should have gotten a complaint to either commit or stash changes). Similarly, switching to branch A still showed both statements s1 and s2 as uncommitted changes. Switching to older branches produced the expected complaint to either commit or stash changes, however. It seems like git is treating branches A, B, and master all as a single branch...why would this be?