learn git branching练习rebase branch

问题一:
按指定顺序提交,第一步将c3移动到c2上,但是使用下面代码无法把bugFix也带上
git rebase c2 c3

解决一:
不知道git rebase main bugFix 和 git rebase c2 bugFix的区别是什么,得到的结果一样
(即不知道bugFix和c2的区别)
git rebase main bugFix

git rebase c2 bugFix

问题二:
下面接着使用下列代码,成功提交了,结果如图6,但是提示标准答案使用的代码更少
git rebase c3' c4
git rebase c4' c5
git rebase c5' side
git rebase side another
解决二:
rebase 的时候上面的记录也会被带上,所以这时候只需要
git rebase c3' side

然后
git rebase side another

结尾:
最后把main拿下来,下面两种都可以
git branch -f main

git branch -f main another

文章讲述了在Git中进行分支操作时,如何按照指定顺序提交(c3移动到c2),理解`gitrebase`命令的不同用法(如`gitrebasec2bugFix`),以及如何在rebase过程中精简操作步骤。最后提到合并主分支的不同方法:`gitbranch-fmain`或`gitbranch-fmainanother`。
1909

被折叠的 条评论
为什么被折叠?



