In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to use the pick command in git". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
In git, pick is often used in conjunction with cherry, and the "cherry-pick" command is used to apply the specified commit to other branches with the syntax "git cherry-pick commitHash"; it also supports transferring multiple commits to the current branch at a time.
This article operating environment: Windows10 system, Git2.30.0 version, Dell G3 computer.
What is the use of pick in git
Git cherry-pick can select one or more commit (s) in a branch to operate (the object of the operation is commit). For example, suppose we have a stable version of the branch called v2.0, and another development version of the branch of v3.0, we can not directly merge the two branches, which will lead to stable version confusion, but want to add a v3.0 feature to v2.0, you can use cherry-pick here.
Is to resubmit the existing commit.
The purpose of the git cherry-pick command is to apply the specified commit to other branches.
$git cherry-pick
The above command applies the specified commit commitHash to the current branch. This will result in a new commit in the current branch, although their hashes will be different.
The method of use is as follows:
Git cherry-pick
The common configuration items for the git cherry-pick command are as follows.
(1)-ejiming Muyube edit
Open an external editor and edit the submission information.
(2)-njinghui murmuri commit
Only the workspace and staging areas are updated and no new submissions are generated.
(3)-x
Add a line (cherry picked from commit...) to the end of the submission message so that you can find out how the submission was made later.
(4)-s ~
Append the operator's signature at the end of the submission to indicate who did the operation.
(5)-m parent-number,--mainline parent-number
If the original commit is a merge node that comes from the merge of two branches, then Cherry pick will fail by default because it does not know which branch's code changes should be taken.
The-m configuration item tells Git which branch changes should be taken. Its parameter parent-number is an integer starting at 1 that represents the parent branch number of the original submission.
$git cherry-pick-m 1
The above command indicates that Cherry pick takes the change that commits commitHash from the parent branch of number 1.
Generally speaking, the first parent branch is the the branch being merged into that accepts the change, and the second parent branch is the the branch being merged from that serves as the source of the change.
That's all for the content of "how to use pick commands in git". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.