重新排序提交后,Git拒绝推送

时间:2018-11-12 15:50:42

标签: git github push

我一直在master分支上从事项目的2个功能。

我们称它们为Feature #1Feature #2

Feature #2提交是最新的。

在提交Feature #2提交之前,没有任何提交被推送到远程。

但是尝试使用最新的提交

git push origin ab34567dff766d0b5bd8698faffcfacf937e06d4:master

也将推动上一次提交,除非我将它们重新排序。

因此,我对提交进行了重新排序(使用git rebase -i HEAD~2)。

我已经拉了git,git status给出了消息:

Your branch is ahead of 'origin/master' by 2 commits.

git push origin ab34567dff766d0b5bd8698faffcfacf937e06d4:master被拒绝:

Updates were rejected because the tip of your current branch is behind

我该怎么办? 这个问题的根源是什么?

1 个答案:

答案 0 :(得分:0)

根据我对您的评论的理解,本地主机是完美的,您希望将远程主机与本地主机设置为同一主机,然后就可以尝试。

git push --force
相关问题