I face your scenario constantly and rapidly got tired of doing it more or less like you described, so I created an alias to fast-forward master without switching to it.
I have created an alias in the [alias] section of my ~/.gitconfig to update master (or any branch) to origin/master without checking it out.
Here is a simple (but unsafe) version of this alias:
ff = !sh -c 'git update-ref refs/heads/$1 origin/$1' -
You call it by typing git ff some_branch, and it uses update-ref to set that branch to origin/some_branch.
Once this alias is defined, your operation becomes:
git fetch
git ff master
git merge master
However, this is unsafe because it will do the update even if is not equivalent to a fast-forward merge, and therefore it might discard some commits. Here is the second version of this alias, with a safeguard so that it only does fast-forwarding, and refuses to do anything in other situations:
# Do a fast-forward merge on the branch specified as argument, as long
# as it's safe: $1 is not checked out, and a fast-forward merge is possible.
ff = !bash -c '\
if [[ `git symbolic-ref HEAD` = refs/heads/$1 ]] ";" then \
echo $1 is checked out, use pull or merge instead. ";" \
else \
git update-ref refs/heads/$1 origin/$1 `git merge-base origin/$1 $1` ";" \
fi' -
I often find the unsafe alias useful too, in particular when I do want to discard some work on my local copy of the branch, so I also kept it as ff-force:
# Not safe - reset the specified branch to its state on origin, even if it's not a fast-forward merge and potentially throws away some commits
ff-force = !sh -c 'git update-ref refs/heads/$1 origin/$1' -
Known limitation for both my aliases: the remote has to be called origin.