Re: How to merge FETCH_HEAD?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:49
"Michael S. Tsirkin" [off-list ref] writes:
OK, I did a fetch and now I can see remote history by $git log FETCH_HEAD But, how to merge it?
You would do "git merge FETCH_HEAD" (note that this would not work for octopus).
$ git pull . FETCH_HEAD error: no such remote ref refs/heads/FETCH_HEAD Fetch failure: .
This is wrong twice.
(1) "git pull" and "git fetch" by design are to fetch what are
exposed, and the remote refnames you give are perfixed with
refs/heads (or refs/tags if you say "git fetch tag v1.0.0")
unless the refnames begin with refs/ already. In other
words, FETCH_HEAD is not something you can "pull".
(2) Remember, "pull is fetch followed by merge." And the way
fetch communicates with the calling "pull" so that it can
drive "merge" is via FETCH_HEAD. So whatever pull you
would do, FETCH_HEAD is cleared first to store the result.
So by doing this (and not redoing the fetch) you broke your own
experiment sequence. And that is why you got this:
$git merge FETCH_HEAD FETCH_HEAD - not something we can merge
because at this point FETCH_HEAD is empty.