我正在尝试在远程分支mainline
上压缩5次提交。为此,我尝试了How to squash commits in git after they have been pushed?。我的本地主线分支现在有正确的压缩提交。但是,当我尝试git push origin +mainline
或git push --force origin mainline
时,我收到了错误
Total 0 (delta 0), reused 0 (delta 0)
remote: To prevent you from losing history, non-fast-forward updates were rejected.
remote: Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note
remote: about fast-forwards' section of 'git push --help' for details.
! [remote rejected] mainline -> mainline (pre-receive hook declined)
A git status
表示本地和远程已分配1到5次提交。这是有道理的我试图将遥控器上的5个提交压缩为1作为清理。
这个提交历史记录有什么问题吗? 由于还没有人使用这个分支,我也可以删除遥控器并重新创建它。