我有一个问题。我有 2 个分支,分别是 master
和 my-destinations
。我对 my-destinations
分支进行了一些不在 master
上的更改。我从 my-destinations
分支提交并推送了更改到我的 git 存储库。
当我切换回 master 时,我提交并推送到存储库的更改并不存在,这是我所期望的。但是,当我切换回 master 并运行 git status 时,它表示 master 是最新的。我本以为它会说 master
是 origin
后面的一次提交。
有人可以帮助我理解为什么 master
与 origin/master
保持同步,但没有提交的更改吗?
最佳答案
Can someone help me understand why master is up to date with origin/master, but does not have the committed changes?
您的本地 master
分支与 github 远程 master
分支具有相同的文件。这就是为什么您的(本地)主分支不在您的(远程)主分支后面。
如果其他人(或来自任何其他远程计算机的您)将新更改提交到(远程)主分支,您的(本地)主分支将落后于(任意数量的提交)。
关于git - 了解使用 Git 和 Github 进行分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46409808/