有没有办法让“gitcherry-pick-x”?只记录最近的“cherry-picked from”信息?
当我们使用 gitcherry-pick -x(cherry pick from commit 5f2662a29efaa91af6b356df2d5d1df69017cac1)
我有一堆我需要不断从一个基础分支迁移到下一个分支的提交。如果我使用cherry-pick -x,它会不断将最新的源提交添加到消息中。
假设我已使用cherry-pick -x 迁移提交两次,我的提交消息如下所示:
commit fb3bead084edc27267219d9a8e088ac613159f69 (my-new-branch)
Author: ----
Date: Thu Feb 17 15:29:15 2022 +0530
Test commit 1
(cherry picked from commit 5f2662a29efaa91af6b356df2d5d1df69017cac1)
(cherry picked from commit 11c6ca55b06cbf333fff9a3cfd50c6617adc2e77)
如果已有消息,是否有办法使cherry-pick -x 覆盖“cherry pick from”消息? 我只想记录最近的源提交。
When we use git cherry-pick -x <commit>
, it records the source commit in the commit message as follows (cherry picked from commit 5f2662a29efaa91af6b356df2d5d1df69017cac1)
I have a bunch of commits which I need to keep migrating from one base branch to the next. If I use cherry-pick -x, it keeps adding the latest source commit to the message.
Suppose I have used cherry-pick -x to migrate the commit twice, my commit message looks like below:
commit fb3bead084edc27267219d9a8e088ac613159f69 (my-new-branch)
Author: ----
Date: Thu Feb 17 15:29:15 2022 +0530
Test commit 1
(cherry picked from commit 5f2662a29efaa91af6b356df2d5d1df69017cac1)
(cherry picked from commit 11c6ca55b06cbf333fff9a3cfd50c6617adc2e77)
Is there way make cherry-pick -x overwrite the 'cherry picked from' message if there is already one?
I want to record only the most recent source commit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这就是它的工作原理。
但你还有其他选择:
--edit
选项(感谢 @joanis 在评论中指出)--no-commit
选项并在实际提交之前更改消息。No, that's the way it works.
But you have alternatives:
--edit
option (thanks @joanis for pointing out in the comments)--no-commit
option and change the message before actually committing it.