Reputation: 2113
I was working on branch A and had done some changes, Commit locally those changes but not pushed. Then I need to fix one urgent issue, switched to another branch B and done some changes their, and commit those changes and pushed.
When I see my log at branch B, it was showing one file changes that was commited in branch A instead of branch B.
Commands that I have executed.
$git status // shows the 2 files that was changed in branch A
$git add -A // add those 2 files that was changed.
$git commit -m "intermediate commit" // need to push later when my current feature will be completed.
$git checkout branch B // switched to second branch
$git status // one file that was changed in branch B
$git add -A // add that file
$git commit -m "imediate issue is fixed"
$git push origin B // push those changes.
See the log in branch B there was two files changed, one that was changed in branch A and one that was changed in branch B.
Why my branch A changes reflected in branch B?
Upvotes: 0
Views: 63
Reputation: 1530
Your best bet to get around this question is by invoking gitk
in your branch B. This will display the commit tree of the branch. You will see when this file change was performed, either directly in branch B or if it was pushed by A and how.
Maybe a file simply slipped your attention, but it's hard for us to say what happened exactly without looking at the commit tree and without the exact commands you performed.
Upvotes: 1