我可以重新绑定和压缩同时提交吗? [英] Can I rebase and squash commits at the same time?
问题描述
当我有一个修改是早些时候提交的一些修改的时候,我总是连续两次运行rebase。是否可以一步完成这个工作流程?
*(master)D
* C
* B
* a
* Base
我在B中找到一个错误,所以我创建了一个分支并修复它。
*(master)D
* C
| *(修复)修复。
| /
* B
* A
*基准
接下来我运行 git rebase --onto fix BD
将C和D移动到B上。
<$ p $ (主)D'
* C'
*(修正)修正。
* B
* A
*基本
git rebase --i修改^^
以查看最后几次提交,并将B和Fix压缩到一个提交中。
*(master)D'
* C'
* B'
* A
* Base
有更快的方法来完成相同的工作流程吗?我想合并会更容易一些,但合并对我来说是不合适的,因为我使用的git svn需要一个线性历史。 p>当交互式资源库中的提交列表编辑器出现时,您可以自由添加,删除或重新排序提交。它基本上是一种影响即将发生的樱桃采摘循环的方式(这是rebase归结为的)。
When I have a fix for a change that was a few commits earlier, I always wind up running rebase twice in a row. Is it possible to do this workflow all in one step? Let's say I have 4 new commits.
* (master) D
* C
* B
* A
* Base
I find a bug in B so I create a branch and fix it.
* (master) D
* C
| * (fix) Fix.
|/
* B
* A
* Base
Next I run git rebase --onto fix B D
to move C and D onto B.
* (master) D'
* C'
* (fix) Fix.
* B
* A
* Base
Finally I run git rebase --i fix^^
to see the last few commits and I squash B and Fix into a single commit.
* (master) D'
* C'
* B'
* A
* Base
Is there a faster way to accomplish the same workflow? I imagine that merging would be easier, but merging is out for me because I'm using git svn which requires a linear history.
When the editor for the commit list in an interactive rebase shows up, you are free to add, remove or reorder commits to your liking. It's basically a way to influence the cherry-picking-in-a-loop that is going to take place (that's what rebase boils down to).
这篇关于我可以重新绑定和压缩同时提交吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!