keep a branch updated

hello,

I have a repository where the main code is in the master but i have a few branches with minimal features which i didn’t implemented yet in the master branch. How could I maintain these branch updated with the newer code inside master?

1 Like

Hi @aster94,

You can merge the master into the branch or cherry-pick the commits that you want in these branches.

Merge solution

From github web interface you can click in the “new pull request” button and choose to merge master into one of your active branch.

When you merge the master into the other branch remember that all the changes made on master will be made even on that branch.

Cherry-pick solution

You can find all the documentation of cherry-pick here: git-cherry-pick

Get the commit ID of the commit you want on the branch.

You can get the commit id by the web UI:

Or with command line:

git log

with output:

commit<u><strong>0624810957941c930b8314d15b1fa9538c54b98c</strong></u> **\<--------------------- this is the commit id** Author: Gabriele Puliti <gabriele.puliti@gmail.com>
Date: Sun Feb 24 19:18:51 2019 +0100

    update (config): create some fast shortcut

Copy this value and run the cherry-pick command with the commit ID you have copied (you need to be in the branch where you want this changes):

git cherry-pick<u><strong>0624810957941c930b8314d15b1fa9538c54b98c</strong></u>

And this is it.

Hope this helps :slightly_smiling_face:  

-Gabriele-

Mark helpful posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great content!

3 Likes

The merge solution is problably what would fit better my needs, but I am also tto lazy to merge every time master inside the branches :grin:

When i would be ready to merge the new features inside master i would use the cherry-pick :+1:

grazie Gabriele!

2 Likes