【发布时间】:2018-11-12 15:50:42
【问题描述】:
我一直在 master 分支上开发一个项目的 2 个功能。
我们称他们为Feature #1 和Feature #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
我该怎么办? 这个问题的根源是什么?
【问题讨论】:
-
您有一个看起来像 SHA 的分支似乎难以置信可疑。向我们展示
git log --graph --oneline --decorate --all的输出。 -
@Makoto 我已关注 this 教程。
-
@Makoko,那不是一个分支。那是他想要在远程分支上保存的修订版本的 id。
-
@RazvanZamfir 你确定你的本地主分支是正确的