Why did a git pull origin master not work, but a git pull did?

17,960

It sounds like your local branch isn't tracking what you think it is. Try issuing git remote show origin and check the "Local branch configured for 'git pull':" section. git pull without specification will default from the "remote" and "merge" configuration of the current branch, per the man page:

Default values for and are read from the "remote" and "merge" configuration for the current branch as set by git-branch(1) --track.

I'd bet you have a different branch configured for tracking than origin/master. It's also possible you're pulling from a different remote. To verify these possibilities, try:

git config branch.master.remote ;# shows you the tracked remote
git config branch.master.merge ;# shows you the tracked upstream branch

These assume your local branch is called master.

Share:
17,960
user1517898
Author by

user1517898

Updated on June 30, 2022

Comments

  • user1517898
    user1517898 almost 2 years

    So I ran into a peculiar problem this morning, and I was wondering if the community could help me figure it out. So I've been doing git pull origin master when I want to fetch and merge the projects changes from the remote master copy and bring them to my local master.

    I've been running into some merging issues lately though, so I did an experiment -
    I did a git pull origin master like always, and got the message that said "Already up-to-date."

    Then I did a normal git pull and then saw all of my coworkers changes rolling in and merging with my local master branch.

    Why did a git pull origin master not work, but a git pull did?

    I wonder how many changes I haven't been seeing because of this quirk I discovered. I've done some research to find out what the differences are but I still haven't found a reason why my repo wasn't being updated properly with a git pull origin master, when I've seen changes being fetched and merged into my branch with that method before.

    Thoughts?

    Thanks in advance.