On Sun, Jun 11, 2017, 22:26 <mssr...@gmail.com> wrote:

> I've come across a git repository with a merge commit on master that was
> created by merging an annotated tag into master.  When I run "git
> merge-base" on the two parent commits to get the common ancestor, nothing
> is returned.  So, question number one is "how could the merge commit have
> been created without a common ancestor?"
>

It is possible, with recent Git versions, to merge two branches that have
no common ancestors. It is advised not to do so, as it requires caution.
Also, that's why it is disabled by default; you have to use a specific flag
to do it.


> As I was investigating a separate issue, I noticed that the repository has
> two base/root commit objects: one on master and one on some other branch (a
> reflog does not exist).  I can artificially create this situation in a new
> git repository by adding a file named "other" to refs/head and then
> checking out "other".
>

You can actually use "gut checkout --orphan other". It will create a so
called orphan branch, that is, a totally new branch that has nothing to do
with any existing commits in the repo.

  However, a later attempt to merge that branch into master fails- no
> surprise.  So, question number two is does anyone have a notion how
> two-base commits could be created without such chicanery?
>

And I hope I answered that with orphaned branches above.


> Thanks for any insight into either question.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to