1

我关注的 GitHub 上有一个项目(上游):

https://github.com/adaptivecomputing/torque

我有这个 repo 的一个分支(起源):

https://github.com/spudstud/torque

新分支已添加到我想要拉入源的上游存储库,然后添加到我的本地计算机。

根据 GitHub 帮助,这应该很容易。我应该能够使用以下命令同步我的 fork。https://help.github.com/articles/syncing-a-fork

git fetch upstream
git merge upstream/master

不幸的是,我想要的上游分支(4.2.3、4.2.3.1、4.2.3.h2、4.2.3.h3)仍然没有出现在 origin

git clone git@github.com:spudstud/torque.git
cd torque/
git remote add upstream https://github.com/adaptivecomputing/torque.git
git remote -v
      origin    git@github.com:spudstud/torque.git (fetch)
      origin    git@github.com:spudstud/torque.git (push)
      upstream    https://github.com/adaptivecomputing/torque.git (fetch)
      upstream    https://github.com/adaptivecomputing/torque.git (push)
git fetch upstream
git checkout master
git merge upstream/master

git branch -a
* master
  remotes/origin/2.5-dev
  remotes/origin/2.5.12
  remotes/origin/4.1-dev
  remotes/origin/4.1.0
  remotes/origin/4.1.4
  remotes/origin/4.1.4-1648
  remotes/origin/4.1.5
  remotes/origin/4.1.5.1
  remotes/origin/4.1.5.2
  remotes/origin/4.2.0
  remotes/origin/4.2.1
  remotes/origin/4.2.2
  **** 4.2.3,  4.2.3.1,  4.2.3.h2,  4.2.3.h3 should show up about here^ ****
  ...
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/upstream/2.5-dev
  remotes/upstream/2.5.12
  remotes/upstream/4.1-dev
  remotes/upstream/4.1.0
  remotes/upstream/4.1.4
  remotes/upstream/4.1.4-1648
  remotes/upstream/4.1.5
  remotes/upstream/4.1.5.1
  remotes/upstream/4.1.6
  remotes/upstream/4.1.6.h1
  remotes/upstream/4.1.6.h2
  remotes/upstream/4.2-dev
  remotes/upstream/4.2.0
  remotes/upstream/4.2.1
  remotes/upstream/4.2.2
  remotes/upstream/4.2.2.ufl
  remotes/upstream/4.2.3
  remotes/upstream/4.2.3.1
  remotes/upstream/4.2.3.h2
  remotes/upstream/4.2.3.h3
  remotes/upstream/master

到目前为止,我所读到的任何内容都无法解释问题可能是什么:

解决方案 感谢答案,我想通了。我不明白我需要将更改推回分支:

git push origin 4.2.4

看来我想做的是“快进”我的叉子。GitHub 曾经有一个快进按钮,它会自动使您的分叉存储库与上游的Fast Forward Your Fork保持同步。看起来 GitHub 摆脱了快进功能(据我所知),所以我必须对每个分支重复这些步骤。

4

2 回答 2

2

您只是合并主分支。如果您想关注上游分支(我认为这就是您想要的,内联注释似乎正在寻找 4.2.3 等),那么您需要在本地跟踪它们(假设您希望可以阅读/编辑这些更改) 然后将它们推回您的前叉。

git checkout -t upstream/4.2.3

然后把它们推回你的叉子

git push origin 4.2.3

fetch 所做的就是拉动整个遥控器。当你时git merge,你的版本只是将上游/主与你的local/master.

于 2013-07-12T21:50:49.403 回答
1

origin你的叉子。上游 repo 被称为upstream, 和upstream/4.2.3,等等,存在。您可以使用 等将它们推送到您的存储库$ git push origin upstream/4.2.3。这两个存储库不会自动同步。

于 2013-07-12T21:39:01.137 回答