我在分支A上工作并做了一些更改,在本地提交这些更改但没有推送。然后我需要解决一个紧急问题,切换到另一个分支B并对其进行一些更改,然后提交这些更改并推送。
当我在分支B看到我的日志时,它显示了在分支A而不是分支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.
查看分支B中的日志,有两个文件已更改,一个在分支A中更改,一个在分支B中更改。
为什么我的分支A更改反映在分支B中?