有一些问题推动我在github的分叉回购
见当前状态
$ git remote -v
origin git@github.com:claudio4j/hal-core (fetch)
origin git@github.com:claudio4j/hal-core (push)
upstream git://github.com/hal/core.git (fetch)
upstream git://github.com/hal/core.git (push)
$ git branch -v
* gui_enhancements c1adba1 remove backup pom.xml~ file
master 5128b4d HAL-335: Workaround using include-aliases=true; more fail-safe RBACGatekeeper
$ git status
# On branch gui_enhancements
nothing to commit, working directory clean
$ git pull --rebase upstream master
From git://github.com/hal/core
* branch master -> FETCH_HEAD
Current branch gui_enhancements is up to date.推失败了。
$ git push origin gui_enhancements
To git@github.com:claudio4j/hal-core
! [rejected] gui_enhancements -> gui_enhancements (non-fast-forward)
error: failed to push some refs to 'git@github.com:claudio4j/hal-core'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.看来我的分叉回购没有更新,与上游叉子相比:enhancements上游:https://github.com/hal/core/commits/master
"git拉“不是更新了我的叉子回购吗?
这就是我不能推的原因吗?
谢谢你的帮助。
克劳迪奥
发布于 2014-01-17 21:45:24
git pull --rebase做一个fetch,后面跟着一个rebase。在新主服务器之上重定位重放提交,因此它“更改历史”;gui_enhancements尖端的旧提交并不是新提交的祖先。
如果您是唯一一个在叉子上使用这个分支的人(可能就是这样),那么您所需要做的就是:
git push -f origin gui_enhancements-f将强行推动通过。
如果你的叉子上有其他人和你在这个分支上合作,那么重写历史会让事情变得尴尬,你可能应该使用真正的(非rebase)拉。以这种方式重做事情:
# I'm taking the sha that your branch used to be on from the output you pasted.
git reset --hard c1adba1
# No --rebase option.
git pull upstream master
# Since "git pull" did a merge commit this time, it'll be a descendant of the
# old gui_enhancements ref on origin, and the push should succeed.
git pushhttps://stackoverflow.com/questions/21195988
复制相似问题