git cherry-pick is used to apply other commit modifications to the current commit.
git cherry-pick description of git documentation:
Apply the changes introduced by some existing commits
is to apply the existing commit (which is understood to be resubmitted)
In general, the two commits that do Cherry-pick are best adjacent . If there are several commits in the middle, then what interval commits are not taken when the Cherry-pick is done.
For example:
My present submission is: 68138b011d7eefbcc06c82a8577cc3935594910d.
There are two new submissions after this submission: 1c81f0129e62d2e79d5f2869c2b547bf17213e87 and 944cc2e483ff6ca86c9973e3cc7758c9030d17f6
I would like to bring these two new submissions to the following steps:
(1) Take the first one to submit:
[Wslu@wslu-cs postgres-xc]$ git cherry-pick 1c81f0129e62d2e79d5f2869c2b547bf17213e87 Automatic Cherry-pick failed. After resolving the conflicts, Mark the corrected paths with ' git add <paths> ' or ' git rm <paths> ' and commit the result with:
Git commit-c 1c81f0129e62d2e79d5f2869c2b547bf17213e87
[Wslu@wslu-cs postgres-xc]$ |
Indicates a conflict,
then manually resolve the conflict. And then execute:
git add xxx1.c xxx2.c #将文件变动添加到索引
git commit--amend #追加到当前提交, which is the first commit.
Or
Git commit-c 1c81f0129e62d2e79d5f2869c2b547bf17213e87
(2) Take a second submission:
The procedure is the same as the first commit.
At this point, complete.