现在有两个分支,分别为分支A、分支B。每个分支上都有若干次提交;
分支A的提交commits有 a1, a2, a3, a4, a5,一共有五次提交;
分支B的提交commits有 b1, b2, b3, b4, b5,一共有五次提交;
当前位于分支A。
注:以上10次提交的hash值不一样。
请问:怎么只拉取分支B的 b2, b3, b4 提交节点到 分支A?
要求,在拉取到分支A后,必须保留原来分支B上的提交信息。
求破 ╮( ̄▽  ̄)╭ ~
@junnplus 说的cherry-pick
方法,是对的,而且我也会;但是有没有更好的回答呢?
On branch A, execute
If automation is not required, the most convenient way is this:
The editor will display five lines from b1 to b5, delete the two lines b1 and b5, save and exit.
It may be difficult to have a better answer, right? According to the
git-flow
的原则,dev-feature
一般不会有只合并中间几次提交到dev
divided situation, maybe the subject's need is based on unreasonable version management strategy or very special scenarios.Should only be chrry pick
Everyone is right, there is no good way; but I still have this special need in my actual work process.
Tonight I used my poor shell programming skills to write a program that can achieve my needs, and it can be achieved through
cherry-pick
.This small program can fulfill my needs as long as it is executed as follows:
Next is my debut: github link