What does cherry-picking a commit with Git mean?

前端 未结 12 2350
梦毁少年i
梦毁少年i 2020-11-22 11:58

Recently, I have been asked to cherry-pick a commit.

So what does cherry-picking a commit in git mean? How do you do it?

12条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 12:19

    Short example of situation, when you need cherry pick

    Consider following scenario. You have two branches.

    a) release1 - This branch is going to your customer, but there are still some bugs to be fixed.

    b) master - Classic master branch, where you can for example add functionality for release2.

    NOW: You fix something in release1. Of course you need this fix also in master. And that is a typical use-case for cherry picking. So cherry pick in this scenario means that you take a commit from release1 branch and include it into the master branch.

提交回复
热议问题