Ronald
Ronald

Reputation: 2917

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

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?

Upvotes: 10

Views: 10862

Answers (2)

Thibault D.
Thibault D.

Reputation: 10005

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.

Upvotes: 29

Zbynek Vyskovsky - kvr000
Zbynek Vyskovsky - kvr000

Reputation: 18825

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.

Upvotes: 6

Related Questions