🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
* 最好在压缩提交前创建 backup 分支,以备不时之需 ## 情形一 * 如需练习,请查看[练习题](https://github.com/yangmin4052/my-git-practice)变基习题一 ```bash # 变基前 ---a---b---c master \ d---e---f topicA \ g---h---i topicB, backup # 变基后 ---a---b---c master |\ | d---e---f topicA | \ | g---h---i backup \ g*---h*---i* topicB # 将从topicA到topicB的部分从topicA处变基到master处 # 变基前记得创建backup分支 git branch backup topicB # 变基命令 git rebase --onto master topicA topicB ``` ## 情形二 * 如需练习,请查看[练习题](https://github.com/yangmin4052/my-git-practice)变基习题二 ```bash # 变基前 ---a---b---c---d---e---f master \ g---h---i HEAD -> topic, backup # 变基后 ---a---b---c---d---e---f---g---h---i HEAD -> topic | \ | master \ g---h---i backup # 变基命令 git rebase --onto master master topic # 当前HEAD位于topic时简写 git rebase --onto master master git rebase master ``` * 有时,你可能需要以下命令 ```bash # 继续变基 git rebase --continue # 中途放弃变基 git rebase --abort # 跳过 git rebase --skip ```