Scenario: The dev branch has two functions, A and B, which have been pushed to the remote branch. Now that function B has passed the test and needs to be incorporated into the main branch, function A is still being tested. At this point we need to merge the B function.

For a multi-branch code base, moving code from one branch to another is a common requirement.

There are two things going on here. In one case, you need all the code changes in another branch, so use git merge. On the other hand, when you only need some code changes (a few commits), Cherry Pick can be used.

Git cherry-pick

Next, use a test repository to simulate!

Now the A and B functions have been committed to the remote branch

Now I’m going to merge the B function on the master branch

steps

1. Switch to the master branch and select View all branches. Select the B feature and right click to select

2. Click to confirm the popup content

3. Then we can see that the local master branch has added a new B function, with a new push

4. Click push to the remote Master branch and return to the Master branch to view the submission record. B functionality already exists for both remote master and local master.