Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I copy 1 specific commit to another branch ? [duplicate]

Tags:

git

I have 2 branches :

  • branchA
  • branchB

I checkout branchB, and fix a small thing while I am on that branch.

commit f2c88cad3d7648cad9c12e724d09db0952abec63
Author: Name <email>
Date:   Fri Mar 18 09:10:22 2016 -0400

    Fix small bug on dashboard 

Then, I do git push origin branchB Which I should have did

git push origin branchA branchB

Now, in branchB I have

commit f2c88cad3d7648cad9c12e724d09db0952abec63

but I don't have it on branchA

How do I copy that 1 commit f2c88ca into my branchA as well ?

Any hints on this will be much appreciated !

like image 294
code-8 Avatar asked Mar 18 '16 14:03

code-8


1 Answers

You can use git cherry-pick command to copy commit to another branch. In your case, once you checkout branchA then do

git cherry-pick f2c88ca 
like image 73
Ankit Bansal Avatar answered Oct 13 '22 11:10

Ankit Bansal