Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does cherry-pick remove the commit from the origin branch?

Tags:

git

suppose I have cherry-picked the commit comm1 from the master branch into branch foo. Will the commit comm1 be removed from the branch master after successful cherry-pick or it will be just copied into branch foo?

like image 644
Ronald Avatar asked Feb 18 '16 09:02

Ronald


2 Answers

It will copy the commit's delta and create a new commit out of it in the active branch.

When you ask yourself questions about what Git will modify or not, keep in mind that you can only modify the active branch. So if your active branch is development and you are cherry-picking a commit from branch feature/test, you can only modify development and not feature/test. This way, you can deduce that the commit in feature/test will not be affected.

like image 54
Thibault D. Avatar answered Sep 20 '22 11:09

Thibault D.


Simply saying it will merge the particular change (commit) into target branch. Merge doesn't affect the source branch so it will be definitely not deleted.

So when you do full merge later, git will already know that this change was already integrated and will skip it.

like image 28
Zbynek Vyskovsky - kvr000 Avatar answered Sep 17 '22 11:09

Zbynek Vyskovsky - kvr000