Git 本地分支已过时,但没有什么可拉的?

Git local branch out of date, but nothing to pull?

我的存储库中的 git 分支每晚调用有问题。当我试图 git push 分支时,我得到了一个错误:

 ! [rejected]        nightly -> nightly (non-fast-forward)
 error: failed to push some refs to 'https://github.com/Martin819/quoll.git'
 hint: Updates were rejected because a pushed branch tip is behind its remote
 hint: counterpart. Check out this branch and integrate the remote changes
 hint: (e.g. 'git pull ...') before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我已经 运行 多次遇到这个问题,所以我认为解决方案很简单。我不得不 git pull.

但是,当我尝试 git pull 时,它说:

 * branch            nightly    -> FETCH_HEAD
 Already up to date.

所以我尝试用 git remote show origin 检查状态并得到:

  HEAD branch: master
  Remote branches:
    master    tracked
    nightly   tracked
  Local branches configured for 'git pull':
    master  merges with remote master
    nightly merges with remote nightly
  Local refs configured for 'git push':
    master    pushes to master    (up to date)
    nightly   pushes to nightly   (local out of date)

我现在很困惑,因为那里说本地分支已经过时了,但是当试图拉它时说已经是最新的了。无论如何如何解决这个问题?

好的,问题解决了。我不小心结帐到 'nigthly' 分支而不是 'nightly' 创建一个新的本地分支,这导致了这个问题。 checkout 到分支机构后问题消失了。