Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: git init doesn't create master branch

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:29

"Ákos, Tajti" wrote:
"Cannot merge multiple branches into empty head"

The command was:

git pull ../dump.dmp refs/heads/*:refs/heads/*

Is this a better way of doing this?
pull runs a fetch, which updated .git/FETCH_HEAD.  Now, if
.git/FETCH_HEAD has just one branch (and other not-for-merge entries),
there's no problem.  We just run update-ref HEAD, and get it to point
to the sole branch that was fetched.  If your fetch fetches multiple
branches, and you have a real branch (not "unborn") with
branch.<name>.merge set, we know which one of those branches to merge
in.

Now, what you have is a fetch which fetches multiple branches, and
you're trying to merge that into a non-existent HEAD (or unborn
branch).  There is ambiguity and arguably no "right" thing to do,
which is why git complains.  I'm not sure if it's possible to argue
differently and patch git-pull.sh for your usecase.

There are many possible solutions to the problem, depending on what
you want.  The simplest I can suggest is: ignore the error for that
command and run git reset --hard.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help