Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the cherry-pick in the git command

Shulou Source: shulou.com Published: 2022-06-03 15:26:53 10月01日 Update

Today, I will talk to you about what the git command is cherry-pick, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Principle

After learning the usage of cherry-pick, I call this command cherry picking. A cherry is like a commit record. Picking cherries is the process of selecting a commit to merge. As shown in the following figure, there are two code branches, one is Master and the other is Feature branch.

A-b-c-d Master\ e-f-g Feature

Now if you want to select only one f to master from the Feature branch, you can use the following command:

# switch to master branch $git checkout master# Cherry pick operation $git cherry-pick f

After the merge, it looks like this

A-b-c-d-f Master\ e-f-g Feature summary

In the process of collaborative development, code branches are often merged, and when merging, there is a requirement to merge one of the features rather than the whole branch, so it is more appropriate to use cherry-pick in this case.

After reading the above, do you have any further understanding of what the git command is cherry-pick? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Branches commands content cherries code that is process appropriate two principle situation pointing time more features knowledge articles industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Shulou Information Shulou Technology Linux