G
G
Georgy Kuznetsov2022-01-19 22:56:24
GitHub
Georgy Kuznetsov, 2022-01-19 22:56:24

How to fix "unable to merge unrelated histories"?

I'm using github desctop ( https://desktop.github.com ) while developing an application with a few other people, and for some reason, when I try to merge two branches into one, the "unable to merge unrelated histories" error is displayed for one of the target branches.

What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2022-01-20
@JoeSmith3100

The reason is stated in the post. You are trying to merge branches that do not have a common history. What for?
I can offer several solutions.
1. Instead of merge, use the rebase command. This will rebuild the merged branch on top of the base branch.
2. The merge command has an option to ignore this error: The last option is used when merging the histories of two projects that started life independently. --allow-unrelated-histories

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question