git merge from commit of another branch


      When using git, if you want to apply a commit (commitId: 9e53a6db43cd5e5d52e5b28b34d83f38ccdb668b) from a branch (branch_A) to another branch (branch_B), you can use cherry-pick, cherry-pick will repeat some commits, that is, put some commits re-execute the changes;

   1. Create a new branch branch_B_1 based on the branch_B branch, and go to the newly created branch 

   git checkout -b branch_B branch_B_1

   2. Repeat a commit on branch_A branch on branch_B_1 branch

    git cherry-pick branch_A 9e53a6db43cd5e5d52e5b28b34d83f38ccdb668b

   3. Merge branch_B_1 to branch_B

  git checkout branch_B 

  git merge branch_B_1



Reference: https://www.jianshu.com/p/d577dcc36a08

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326102079&siteId=291194637