git fetch shows nothing on console
git fetch
or git fetch origin
are fine, but if there is nothing to do, nothing is displayed.
You can use git fetch -v
to be more verbose and display more informations
Regarding the last part, as mentioned in "Fun with FETCH_HEAD", you can do:
$ git fetch git://repo.or.cz/stranger.git for-junio
$ git log -p ..FETCH_HEAD
$ git merge FETCH_HEAD
Because "
pull
" is "fetch + merge
", we are explicitly decomposing the operation into two steps."
fetch
" leaves the information on the branch it found on the other side inFETCH_HEAD
, which you can use as to name the commit object sitting at the tip of the branch.
"git log -p ..FETCH_HEAD
" (notice the double dots) lets you view the commits he has but not in your branch with their changes in patch form to inspect what he did was sensible.
If you are satisfied, you can useFETCH_HEAD
to merge the commit in to your branch.
(See for instance this answer)
As detailed in "How Do I 'git fetch
' and 'git merge
' from a Remote Tracking Branch (like 'git pull
')", you don't have to use FETCH_HEAD if you have a upstream branch defined:
git fetch origin
git merge origin/an-other-branch
git fetch origin an-other-branch
stores the fetched tip inFETCH_HEAD
, but notorigin/an-other-branch
(i.e. the usual ‘remote tracking branch’).
So, one could dogit fetch origin an-other-branch && git merge FETCH_HEAD
.
For the first part, make sure your branch has an upstream branch set to your remote upstream repo.