如何挑选其他合并路径?
我有这样的结构:
B - C - D <- feature
/ \
A-----------E <- master
^ mytag
B、C 和 D 提交是功能分支路径。 A 是公共基数。此功能作为 E 提交合并回 master。我已经标记(自动)提交 A。
我希望在没有用户干预(来自脚本)的情况下自动进行,无论功能分支中有多少提交,都可以将“mytag”选为“master”作为 A、E(在本例中) )在另一个分支。
现在,如果我这样做:
git checkout other
git cherry-pick mytag..master
它将选择 A、B、C、D 和 E 提交。我希望它只从主分支(即 A 和 E)中选择提交。 注意:我不想以相反的方式合并到 E 中。我希望它能融入到母版中。 A 到 E 根本不确定这是分支。它可能是 A --- E。只是我需要类似“..”运算符的东西,但要使用其他分支的方式。
感谢您提前的帮助!
此外: 第三个分支是我应该挑选的,应该看起来像这样:
F - G - H - A - E <- other
即 A 和 E 将在“其他”分支中挑选。
I have this structure:
B - C - D <- feature
/ \
A-----------E <- master
^ mytag
B, C and D commits are feature branch path. A is a common base. This feature is merged back into master as E commit. I have tagged (automatically) commit A.
I would like automatically without user intervention (from script), no matter how many commits are there in the feature branch to cherry pick "mytag" to "master" as A, E (in this case) in another branch.
Now if I do:
git checkout other
git cherry-pick mytag..master
it will pick A, B, C, D and E commits. I would like it to pick commits only from master branch, i.e. A and E.
Note: I don't want to merge into E in the opposide way. I want it feature into the master. And A to E is not sure that is branching at all. It could be A --- E. Just I need something like ".." operator, but to use other branch'es way.
Thanks for the help in advance!
In addition:
The third branch were I should cherry-pick, should look like that after:
F - G - H - A - E <- other
i.e. A and E will be cherry-picked in "other" branch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是答案:
--first-parent是cherry-pick的未记录选项。我在 log 命令中看到它,它也适用于前者。它正在做我需要的事情。默认情况下,要遍历第一个父级,而不是分支。
仅返回 A 和 E 提交。
-m 1 选项仅用于合并提交,对于非合并提交失败,反之亦然。所以我尝试使用,如果失败-不使用。
This is the answer:
--first-parent is undocumented option of cherry-pick. I saw it in log command and it is working for former, too. It is doing exactly what I need. To traverse first parent, not branch'es one as is by default.
is returning only A and E commits.
-m 1 option is used only for merge commits and fail for non-merge commits and vice verse. So I try with and if it fail - without.