I have a project called Proyect
which has three ( 3 ) branches:
master
( M )sdev
( S )test
( T )
Which at the moment are like this:
initial commit
↓
↓
↓ merge test into master
↓ checkout -b sdev master
↓ ↓
↓ ↓
M------*------------------------------* # HEAD
\ / \
\ / \
\ / \
T-------\--------\--------------* # commits behind master
\ \
\ \
S-*--*---*---------* # commits behind test behind master
↑ ↑ ↑
↑ ↑ ↑
↑ ↑ ↑
↑ ↑ merge test into sdev
↑ ↑
↑ ↑
↑ commit 2 que quiero pushear directamente a master
↑
↑
commit 1 que quiero pushear directamente a master
What I want to do and I don't know is to perform a merge
specific del commit 1
and commit 2
branch sdev
directly to the branch master
without affecting anything in the commits
subsequent branches sdev
and test
, that is, I would like something like this:
M------*------------------------------*-*--* # HEAD
\ / \ ________________↑ ↑
\ / \ / _________________↑
\ / \ / /
T-------\-------*-*------------------* # commits behind master
\ / /
\ / /
S-*--*---*--------------* # commits behind test behind master
I simply had to make use of git cherry-pick
First : I moved to the branch
sdev
with a simplegit checkout sdev
Second : I looked up the unique identifiers
SHA-1
of the branch commitssdev
with a simple:git log --pretty=oneline
, which gave me:Third : I went back to the branch
master
(which is where I wanted to perform themerge
)Fourth : Then I proceeded to perform the cherry-pick
The cherry-pick can be canceled by adding the option
--abort