How do I/Should I commit one set of changes to multiple branches?

I'm not sure the best way to handle this, but I think what I want to do is push one set of changes to multiple branches, or duplicate the most recent changes in multiple branches.

I have one project, that has three separate targets, that (currently) only differ in "branding" (icons, splash screens, messages, etc.) and version number.  I just made a large set of changes that only affected shared code, so I checked the changes into origin/master.  I'd like the same "snapshot" of code to be in each of the brand-specific branches.

  • Can I copy the last commit to origin/master to each branded branch?
  • Is my only choice to check-out the code and commit to each branded branch?
  • Can I do this a better way?

I'd like to do this using SourceTree (Mac), but I can use the Bitbucket web interface, or raw git commands, if necessary.

1 answer

1 accepted

I'm not entirely sure if this will work with your branching strategy, but the ideal solution would be to merge master into each other branch.

If there are other changes to master that you don't want to propagate to the other branches, you can check out each other branch and "cherry-pick" the commit in question (in SourceTree, right-click the commit you want to cherry-pick).

Ah, didn't think of merging out of master. This will work because there's no unique code between the versions, right now.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

262 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot