Skip to content
Zaki Mughal [sivoais] edited this page Mar 6, 2015 · 6 revisions

Merging a topic branch

Say you have a remote called origin which points to a PDL repository that has a topic branch called enable-widgets that you want to bring in to the master branch.

First, you want to fetch the branches from the git repository.

git fetch origin

This will allow you to access all the branches that are currently at the origin remote. You can check which branches are available by running git branch -v.

Now you need to choose the branch that you want to merge the commits on to. We'll go with bringing in the commits to the master branch:

git checkout master

Finally, we bring in the commits from the feature branch enable-widgets and merge them on top of the current state of master:

git merge --ff-only enable-widgets

Now you can push the commits on master to the repository you want:

git push origin master

Note: to understand what the --ff-only option does, you can read http://ariya.ofilabs.com/2013/09/fast-forward-git-merge.html.

Clone this wiki locally