How can I merge 1 commit from branch to another branch

I will switch to branch (branch1) in git and I have made several commits in this branch. And now I am switching to another branch (branch2), how can I combine 1 (the last in branch1) with this new branch (branch2)?

If I do "git merge branch1" when I am in branch2, I will merge all the commits that I made in branch1. I do not want me to need only the latter.

Thanks.

+4
source share
1 answer

Do you want to:

$ git cherry-pick COMMITID 

See the git cherry_pick man page :

Given one or more existing commits, apply the change that everyone introduces, recording a new commit for each.
This requires your working tree to be clean (no changes from the HEAD commit).

+8
source

Source: https://habr.com/ru/post/1337189/


All Articles