如何在本地同步远程GitHub分支

时间:2017-12-02 17:53:03

标签: git github branch master upstream-branch

我已将GitHub上的上游项目分配到Github上的原始仓库和本地主副本。

我也想同步上游分支,所以我跑了:

$ git fetch upstream

添加了新分支:

$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/new/one
remotes/origin/new/two
remotes/origin/master
remotes/upstream/new/one
remotes/upstream/new/two
remotes/upstream/master


$ git remote show upstream
   HEAD branch: master
  Remote branches:
    new/one   tracked
    new/two tracked
  master            tracked
    Local ref configured for 'git push':
  master pushes to master (local out of date)

所以我跑了:

$ git merge upstream/new/one
35 files changed, 1194074 insertions(+), 119 deletions(-)
$ git branch -a

仍然只显示没有分支的本地主人

$ git checkout -b one upstream/new/one
$ git checkout -b two upstream/new/two
$ git branch -a
  one
  master
* two
  remotes/origin/HEAD -> origin/master
  remotes/origin/new/one
  remotes/origin/new/two
  remotes/origin/master
  remotes/upstream/new/one
  remotes/upstream/new/two
  remotes/upstream/master
$ git merge upstream/new/two
Already up-to-date.

虽然我可以在本地看到Master文件,但我无法访问那些似乎没有在本地同步的分支。

如何在本地计算机上访问它们?

0 个答案:

没有答案