There is such a situation: enter image description here When you try to merge the patch-1 (green) and CLang (dark blue) branches from the master, the githab gives:

There is nothing to compare.

patch-1 and CLang are entirely different commit histories.

which is quite logical, since neither the master (red) nor the CLang (dark blue) branched from the master is a branch from the previous CLang (black) or any previous branch of the project, and therefore cannot have a common history of commits.

The question is how to merge these two branches?

  • How, in your understanding, should the result of such a merger look like? - Pavel Mayorov
  • one
    Try to give a minimal example. Reproduce a similar situation in the temporary repository of a pair of files on a pair of lines and several commits, and put them here either in kommitno or through a list of commands to play, along with the desired result. - Pavel Mayorov

1 answer 1

You are trying to smuggle two branches that have no common ancestor. Git can do this, but does not allow it until you are sure that you know exactly what you are doing.

If you are sure that you need to merge these branches, do this:

git merge --allow-unrelated-histories patch-1 CLang 

Just in case: I suspect that branches appeared due to an error in the workflow: the branch for development was confused with the branch for documentation. I'll tell you a little more.

GitHub allows you to create websites (called GitHub Pages), accompanying a certain project (repository) or representing a personal user page. One of the options for storing the contents of such a site is in the general repository of the project, but in an "orphaned" branch under the name gh-pages .

Probably someone tried to set up GitHub Pages and created such a thread. The first commit of this thread contains the template for the site page. On the graph, this is the first (left) commit of the red line. After the master branch of the same repository was rearranged to this branch and development continued in it. According to the graph given in the question, it can be seen that on the fifth kommite the branch CLang departed from it.