Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

git - Cherry-Picking few commits from another branch

I have a scenario where I don't want to cherry-pick a specific commit but a range of git commits from remote. I can do force pull with hard option but that will get all the commits including latest changes from remote. Please suggest how can I pick range of commits from remote.


For instance, this is what I am trying:

git checkout -b newbranch 62ecb3

git rebase --onto master 76cada, 56qwqw, 46erer
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Let's say the history is A-B-C-D-E-F-G, and you'd like to cherry-pick C-D-E-F.

git cherry-pick B..F

or

git cherry-pick C^..F

or

git cherry-pick C D E F

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...