【问题标题】:Git local branch out of date, but nothing to pull?Git本地分支已过时,但没有什么可拉的?
【发布时间】:2018-05-01 12:31:21
【问题描述】:

我的仓库中每晚调用的 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)

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

【问题讨论】:

  • 你的nightly 分支上的git status 说什么?
  • 上面写着On branch nigthly nothing to commit, working tree clean
  • 那么,您的本地分支没有任何更改是吗?还是有一些未跟踪/未提交的文件?
  • 我愿意,但我已经创建了包含所有本地更改的提交。现在我无法推动它们。
  • 如果你已经提交了,那么它应该是your branch is ahead of origin/nightly by 1 commit。顺便说一句,提交名称是什么? git pull origin nightly?

标签: git github push git-branch pull


【解决方案1】:

好的,问题解决了。我不小心结帐到“夜间”分支而不是“夜间”创建一个新的本地分支,这导致了这个问题。结帐到分支后,问题就消失了。

【讨论】:

    猜你喜欢
    • 2020-02-02
    • 2013-03-21
    • 1970-01-01
    • 2021-09-13
    • 2014-06-09
    • 2013-05-09
    • 2019-09-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多