My awkward git use case: while working on a branch, I frequently want to merge changes from the (upstream, remote) master into my branch. Is there a faster way to do this than switch to master, pull, switch back, merge master?
git fetch remotename
git merge remotename/master
But you usually just want to rebase your changes onto the latest HEAD: git fetch remotename
git rebase remotename/master
Merging will place the remote branch's changes after yours, which will make your history a nightmare, especially if you're going to continue working on your branch. Rebasing will place your local branch changes after the latest changes to the main branch.A "git fetch <remote>" would then update the remote tracking branches.
Now to your specific question (fast-forward a local branch without checking it out), you can
git fetch origin master:master
or git push . origin/master:master
Then you can merge 'master' instead of 'origin/master', thus eliminating the remote URL or "remote-tracking" language from the prepared commit message.[1] http://gitster.livejournal.com/42247.html
[2] http://lwn.net/Articles/328436/
[3] http://yarchive.net/comp/linux/git_merges_from_upstream.html