Git 告诉我我的分支没有跟踪信息,但远程上有我的分支的旧版本



我的同事向master提交了一些更改,我不得不相应地更新我的分支。经过一番挣扎,我认为我做对了。但是,当我运行git remote show origin时,我得到:

* remote origin
  Fetch URL: https://bitbucket.org/....git
  Push  URL: https://bitbucket.org/....git
  HEAD branch: master
  Remote branches:
    layout        tracked
    layout-report tracked
    master        tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local refs configured for 'git push':
    layout        pushes to layout        (fast-forwardable)
    layout-report pushes to layout-report (local out of date)
    master        pushes to master        (up to date)

我正在尝试工作的分支是 layout-report ,上面写着"本地过时"。所以我尝试了git pull,我得到:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
    git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
    git branch --set-upstream-to=origin/<branch> layout-report

在BitBucket上,我可以看到我的分支。这是怎么回事?

您可能已经使用git push origin branch推或拉了它

没有跟踪信息只是意味着默认情况下没有指定它应该推送到/拉取的位置。

git甚至告诉您如何设置此(默认)跟踪信息:

git branch --set-upstream-to=origin/<branch> layout-report

请参阅 git 书中的使用遥控器。

相关内容

最新更新