git - 了解使用 Git 和 Github 进行分支

标签 git github branch git-merge

我有一个问题。我有 2 个分支,分别是 mastermy-destinations。我对 my-destinations 分支进行了一些不在 master 上的更改。我从 my-destinations 分支提交并推送了更改到我的 git 存储库。

当我切换回 master 时,我提交并推送到存储库的更改并不存在,这是我所期望的。但是,当我切换回 master 并运行 git status 时,它表示 master 是最新的。我本以为它会说 masterorigin 后面的一次提交。

有人可以帮助我理解为什么 masterorigin/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/

相关文章:

Git:使用Kdiff3从另一个分支 merge 到一个分支

python - 是否可以在 Google Colab 中导入一个 python 文件,它本身导入一个 GitHub 存储库来运行?

git - 检查远程 Git 上是否存在本地分支

Git 推送 : "fatal ' origin' does not appear to be a git repository - fatal Could not read from remote repository."

git - 显示提交 A 处于打开状态且提交 B 未处于打开状态的所有分支?

linux - Git 无法处理 nfs 共享

git - 如何使用 Github Desktop 克隆非 github 托管的存储库

git - 使用另一个文件夹中的 git "log"

git - merge 两个 git repos

git - 在不初始化 .gitignore 的情况下将现有项目添加到 Github