Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git fetch upstream doesn't work

Tags:

git

I'm trying to use git fetch upstream master to get the latest commit from another user's repository. But unfortunately that doesn't work. I have also tried git fetch upstream.

What does work is git pull upstream master, but I don't want to use that all the time, because that will always automatically perform a merge.

This is the output that I get when I execute git fetch upstream master:

git fetch upstream master
From https://github.com/jchun/nodeSite
 * branch            master     -> FETCH_HEAD

And here are my remotes:

git remote -v
origin [email protected]:superzaky/nodeSite.git (fetch)
origin [email protected]:superzaky/nodeSite.git (push)
upstream       https://github.com/jchun/nodeSite.git (fetch)
upstream       https://github.com/jchun/nodeSite.git (push)
like image 311
superkytoz Avatar asked May 03 '15 17:05

superkytoz


People also ask

How do I fetch from upstream GitHub?

GitHub has now introduced a feature to sync a fork with the click of a button. Go to your fork, click on Fetch upstream , and then click on Fetch and merge to directly sync your fork with its parent repo. You may also click on the Compare button to compare the changes before merging.

How do I fetch upstream local branch?

If you want a local branch, use the --track option. "git fetch" to make sure your repo is updated with remote references and "git checkout --track origin/discover" should be enough. Then you can commit to that branch and a "git push" to sync the remote with your changes.

How do I show upstream in git?

The easiest way to set the upstream branch is to use the “git push” command with the “-u” option for upstream branch. Alternatively, you can use the “–set-upstream” option that is equivalent to the “-u” option. As an example, let's say that you created a branch named “branch” using the checkout command.


1 Answers

The fetch did work, but to see the result, you should do a:

git log --oneline --all --graph --decorate --branches

You would see the upstream branches (including the upstream/master)

You can also check the latest SHA1 fetched with:

git branch -avv

The git pull upstream master didn't repeat the fetch part (since it was already done), but merge as well upstream/master to master.

like image 107
VonC Avatar answered Sep 17 '22 15:09

VonC