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

Git rejects push after reordering commits

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

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

Feature #2 提交是最新的。

None 的提交被推送到远程,直到需要推送 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

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

根据你的评论,我了解到本地大师是完美的,你想让遥控器和本地一样,那么你可以试试。

git push --force