You can simply fetch, and then merge
git checkout newbranch
git fetch
git merge origin/master
Here, fetch
is enough to update your remote tracking branches (the ones in your .git/refs/remotes/origin
): you can merge directly from one of those, like origin/master
.
I like git fetch
because it won't change any file in your working tree, so it is a safe first step.
git pull
would fetch plus merge into your current branch.
As an additional step, you can update your local master branch if you want.
I would recommend
git config --global pull.rebase true
git config --global rebase.autoStash true
That way, this is enough, even if you have made some local commits on master, and have some pending modifications:
git checkout master
git pull