【发布时间】: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 nigthlynothing 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