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

时间:2017-11-17 16:49:47

标签: git github push git-branch pull

我的回购中有一个名为nightly的git branch的问题。当我试图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)

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

1 个答案:

答案 0 :(得分:0)

好的,问题解决了。我意外地检查了'nigthly'分支,而不是'夜间'创建一个新的本地分支,这导致了这个问题。在切入分支后,问题就消失了。