Difference between "fetch and rebase" vs "checkout, pull and rebase."

When I sit down to work in the morning, I peer through the steam from my coffee and...

  1. checkout to master
  2. pull down the latest remote changes
  3. checkout to whatever branch I'll be starting in
  4. and merge or rebase the latest changes in

I've started seeing the inefficiency in some of my workflows and am attempting to streamline some approaches with using the command line more often, which raised this question:

What is the difference between:

git fetch origin
git rebase origin/master

vs

git checkout master
git pull origin master
git checkout -
git rebase origin/master

...can you instead do something along these lines with the same effect?

git pull -r origin/master

Coming from a place where I used the vscode (or intellij) GIT GUI too often, I find it difficult to establish the "why" with some git command flows. They seem to do similar actions in different ways. For every thread I read, there are N-number of follow-ups with "better" or alternate approaches coupled with little to no reasoning or explanation. If there are any resources detailing common git flows and alternatives for any deviations please share! I've had some luck looking through various alias setups on github for this, but always want more resources.


The difference is that with the longer set up of commands, you are typing more commands and spending a few extra seconds of your life, and also updating your local copy of the master branch.

My personal preference is to never even checkout master locally, or if I do, delete it shortly after. I don't like to keep local copies of shared branches around because I might accidentally use an outdated version of them. I always prefer:

git fetch
git rebase origin/master

I also rarely ever use pull for anything, even though as you point out it would save doing the fetch explicitly. Instead I like to do the fetch command frequently, so that I can glance at the output and see when specific branches were updated, created, deleted, etc. Instead of pull, I almost always will fetch and then either merge or reset to update my local copy of a branch, which is admittedly rare. 99% of the time I'm rebasing my local branches onto a shared origin/master or similar.