Updating local git branch to latest master

Linus Torvalds torvalds at linux-foundation.org
Fri Oct 18 09:36:45 PDT 2019

On Fri, Oct 18, 2019 at 9:03 AM Willem Ferguson
<willemferguson at zoology.up.ac.za> wrote:
> If I say git pull or git pull origin, I get "Already up to date".
> However when I do git log it does not show any updates after my last
> commit 2 months ago.
> Am I crazy?

If you don't mention an explicit branch, "git pull" (and "git pull
origin") will just take the matching branch that you used as a base
for your branch.

I'm guessing that you started your current local branch from some
upstream branch that hasn't been changed since, and now you want to
update to the upstream *master* branch?

So depending on what you actually want to do, you might do

 (a) git pull origin master

The above is _probably_ not what you want to do if you have some local
modifications, since it will just merge whatever state you have. Maybe
that's what you want, maybe it isn't. It's hard to really guess.

 (b) git pull --rebase origin master

The above will stay on your local branch, fetch the current origin
master, and then rebase any changes you had on your local branch.

 (c) git checkout master && git pull

The above will leave your old branch behind, switch to the master
branch, and then do a "git pull" (which, assuming you hadn't done any
modifications to the master will just fast-forward to the current
upstream state)

 (d) any number of other possibilities, depending on what it is you
really want to do with the changes you already had.

Yeah, git allows you a lot of latitude in what you do in your
branches, which is why it's hard to tell exactly what you _want_ to be


More information about the subsurface mailing list