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.
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
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
$ git checkout feature $ git rebase master
Do note that this changes the commit ID for each commit in your feature branch, which will cause trouble for anyone sharing and/or following your branch. In this case, if you have rebased a branch that other users are watching or working on, they can fix the resulting conflict by rebasing their copy of your branch onto your branch:
$ git checkout feature $ git fetch remote/feature $ git rebase remote/feature
For any publicly-shared branches, where other users may be watching your
feature branches, or cloning them locally for development work, you'll need
to take a different approach to keeping it up to date with
To bring public branch up to date, you'll need to merge
master branch, which will create a special
"merge commit" in the branch history, causing a logical "split" in commit
history where your branch started and joining at the merge. These merge
commits are generally disliked, because they can crowd commit history, and
because the history is no longer linear. They will be dealt with during
the submission process.
$ git checkout feature $ git merge master
At this point, you can push the branch to your public repository, and anyone following the branch can then pull the changes directly into their local branch, either with another merge, or with a rebase, as necessitated by the public or private status of their own changes.