当前位置:   article > 正文

关于 git rebase 的踩坑记录_rebase 提示 behind

rebase 提示 behind

按照习惯,先放结论:

执行 git rebase --continue 到 Successfully rebased and updated refs/heads/dev 后,下一步需要 push 到自己的分支上,执行:

git push origin dev --force 即可。

注意,千万不要在 master 分支上改,要在自己 git branch 出来的分支上修改。

----------------------- 分割线-------------------------

下面聊聊此次踩坑的一点心得。

最近被要求使用 git rebase,控制一下个人提交 mr 时 commit 的个数。

期间我花了一下午的时间尝试研究这个问题,结果每次到 Successfully rebased and updated refs/heads/dev 后,使用 git push origin dev ,会提示:

! [rejected]  dev -> dev (non-fast-forward)
error: failed to push some refs to gitXXXX

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

然后我就根据提示 git pull origin dev ,再 git push origin dev。最后发现,git log 不对啊,还是好几个 commit,我 rebase 了个寂寞啊,所以,当执行到 Successfully 这一步的时候,千万不要 git pull,否则就前功尽弃了。

最后经过我的不懈努力 + 向大佬求救,终于成功了。有需要的话,改天手把手的带大家走一遍 git rebase 的流程。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/600022
推荐阅读
相关标签
  

闽ICP备14008679号