如何在进行交互式重新压缩之后进行压缩编辑? [英] How do I edit after squashing while doing an interactive rebase?

查看:122
本文介绍了如何在进行交互式重新压缩之后进行压缩编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚在rebase期间如何获得压缩提交的结果。我希望能够在2次提交被压缩到前一次提交后编辑提交。我的rebase文件如下所示:

  p f70f90f ...一些消息... 
s 514ee77 ... some消息...
s ab01b05 ...某些消息...
< - 要在此处编辑3次提交!
p b109cc1 ...一些消息...

我已经试过了:

  e f70f90f ...某些消息... 
s 514ee77 ...某些消息...
s ab01b05。 ..一些消息...
p b109cc1 ...一些消息...

但是这让我编辑第一次提交,然后压缩下两个。



和:

  p f70f90f ...一些消息... 
s 514ee77 ...某些消息...
s ab01b05 ...某些消息...
p b109cc1 ...某些消息...

但是,这使我直接进入了我的文本编辑器来编辑最后的提交消息3提交,没有给我一个机会来编辑提交本身。



我相信我可以使用两个rebase来解决这个问题:1)我在其中压扁,2)我在其中编辑。但是分支有足够多的以下提交,rebasing需要很长时间。



如何在单个rebase中执行此操作?还是有另一种更合适的解决方案?

(我意识到重新公开可视化工作的问题,这些对本项目来说不是问题)。

您可以在第三次提交时停止编辑

  p f70f90f ...一些消息... 
s 514ee77 ...某些消息...
e ab01b05 ...某些消息...
p b109cc1 ...一些消息...

这样你停在 ab01b05 进行编辑。所以如果你

git reset --soft HEAD ^



然后你可以做你的改变。然后

git commit --amend



压缩最后一次提交的更改(现在是 f70f90f 514ee77 的壁球)



,然后设置好。



之后,a

git rebase --continue



会带您进入rebase的下一步。


I can't figure out how to get access to the results of a squashed commit during a rebase. I would like to be able to edit the commit after 2 commits have been squashed into the previous one. My rebase file looks like this:

p f70f90f ... some message ...
s 514ee77 ... some message ...
s ab01b05 ... some message ...
                                <-- want to edit 3 commits here!
p b109cc1 ... some message ...

I have already tried:

e f70f90f ... some message ...
s 514ee77 ... some message ...
s ab01b05 ... some message ...
p b109cc1 ... some message ...

But that lets me edit the first commit, then squashes the next two.

And:

p f70f90f ... some message ...
s 514ee77 ... some message ...
s ab01b05 ... some message ...
p b109cc1 ... some message ...

But that takes me straight into my text editor to edit the commit message for the last 3 commits, without giving me a chance to edit the commit itself.

I believe I could solve this issue using two rebases: 1) in which I squash, and 2) in which I edit. But the branch has a sufficient number of following commits that rebasing takes quite a while.

How do I do this in a single rebase? Or is there another, more appropriate solution?

(I am aware of the issues with rebasing publicly visible work, those aren't problems for this project).

解决方案

You could stop for editing on the third commit

p f70f90f ... some message ...
s 514ee77 ... some message ...
e ab01b05 ... some message ...
p b109cc1 ... some message ...

that way you stop at ab01b05 for editing. So if you

git reset --soft HEAD^

you can then do your changes. Then

git commit --amend

will squash the changes to the last commit (which now is the squash of f70f90f and 514ee77)

and you are set.

After that a

git rebase --continue

will take you to the next step of your rebase.

这篇关于如何在进行交互式重新压缩之后进行压缩编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆