Product SiteDocumentation Site

1.4. Preparing Feature Branches

For each local or shared feature branch that you are working on, you will need to keep it up to date with the appropriate master branch. There are multiple methods for doing this, each better suited to a different type of feature branch. Both methods assume that you have already performed the previous step, to update your local tracking branches (see Section 1.3, “Maintaining Tracking Branches”).

1.4.1. Private Branches

If the topic branch in question is a local, private branch, that you are not sharing with other developers, the simplest and easiest method to stay up to date with master is to use the rebase command. This will append all of your feature branch commits into a linear history after the last commit on the master branch.
git rebase master feature

Note

Rebasing changes the ID for each commit in your feature branch, which will cause trouble for anyone sharing and/or following your branch.
The resulting conflict can be fixed by rebasing their copy of your branch onto your branch:
git checkout feature
git fetch remote/feature
git rebase remote/feature