0

I have two branches branch A and branch B in GIT project. where i have committed a code to branch A which is patch 1. Then cherry picked patch 1 of branch A to branch B. later i gave a second patch (patch 2) to the same commit in branch A. How to add this patch 2 of branch A to branch B?

Vedavyas Velaga
  • 111
  • 1
  • 1
  • 9

1 Answers1

0

If no other commits are involved, here's a simple solution:

git checkout branch-B
git reset HEAD^ --hard
git cherry-pick <same-commit>

It will look like no new commit is created on branch-B.

If you don't mind adding a new commit to branch-B, just git cherry-pick <same-commit>.

But after you gave a second patch to the same commit, the commit id should be changed. So in fact we have two commits. To be clear, the <same-commit> above is actually the second commit id.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53