[git] How can I keep my branch up to date with master with git?

I have a bug fix in my master, and I also want my branch to get that bug fix. What git command do I use?

This question is related to git github

The answer is


If your branch is local only and hasn't been pushed to the server, use

git rebase master

Otherwise, use

git merge master

You can use the cherry-pick to get the particular bug fix commit(s)

$ git checkout branch
$ git cherry-pick bugfix

If you just want the bug fix to be integrated into the branch, git cherry-pick the relevant commit(s).