Reputation: 6428
I've got a repo with an origin and an upstream remote. Typically in my workflow I pull changes from my upstream, and then push them to my origin (in this case, my upstream is my company's GitHub organization's repo, the canonical one, and my origin is my fork of that).
The problem is that my upstream/master
remote tracking branch doesn't seem to
update with I git pull upstream master
or git fetch upstream master
.
So if I start out with something like this:
* d386ff8 (upstream/master, origin/master, master) commit 1
And then run git pull upstream master && git push origin master
, I end up
with something like this:
* 197ac91 (origin/master, master) commit 2
* d386ff8 (upstream/master) commit 1
I know that the master branch on the upstream repo is at commit 2, 197ac91
(i can verify by either visiting its github page or re-cloning the repo), so why isn't the upstream/master
remote tracking branch on 197ac91
in my repo? The only time the upstream/master
remote tracking branch in my repo moves is when i push to it. How do I get it to reflect where the master branch on the upstream repo actually is?
Here is my .git/config
:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = [email protected]:me/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "upstream"]
url = [email protected]:mycompany/repo.git
fetch = +refs/heads/*:refs/remotes/upstream/*
UPDATE: this seems to be a duplicate of this question. i can solve my problem by running git fetch upstream
. apparently adding the master
to the end of that command, for some reason, prevents the local remote tracking branches from being updated.
Upvotes: 1
Views: 201
Reputation:
This is mostly speculation, but from your edits and git-pull-origin-master-does-not-update-origin-master, it seems like when you specify
git pull upstream master
git notices that you've specified a fetch from upstream
, and then it notices that you want to update the master
branch. But instead of updating from upstream/master
it sees that master
has the remote origin
and instead updates from there.
From the other thread, it looks like you should be using git pull upstream/master
to update your local branch.
Upvotes: 1
Reputation: 410552
If you don't push to upstream
, and no one else pushed your changes, then upstream
probably hasn't been updated with your latest commits.
Upvotes: 0