Commit to multiple branches at the same time with git Commit to multiple branches at the same time with git git git

Commit to multiple branches at the same time with git


You could:

  • make all your commits on A
  • rebase B on top of A (if you haven't pushed B already, that is)

That way, B will include all commits from A, plus its single commit.


If you have shared B (pushed to a common remote repo), the idea is more to add any commit made on A to B (that is, "on top of B).

The simplest way would be to merge A on B, if you don't mind having only one commit on B representing all commits from A.
I would prefer that to any solution involving cherry-picking would mean different SHA1 for each commit recreated on B, which would make any future merge back to A complicated (because Git would go back a long way to find a common ancestor)


the cherry-pick feature is a better way to do this, check answer at

Git: Commit to multiple branches at the same time