Tag Archives: Git 、 Maven 、 Gradle

Resolving fatal: reusing to merge unrelated histories in Git

An error of Git
Sometimes there are some problems in the process of using Git, so when you solve each problem, you need to summarize and record it, so that you won’t do it again.
A, fatal: refusing to merge unrelated nothing
Today, while creating a project with Git, the following error occurred when two branches were merged.

~/SpringSpace/newframe on  master ⌚ 11:35:56
$ git merge origin/druid
fatal: refusing to merge unrelated histories

The key to the problem here is: fatal: refusing to merge unrelated nothing
you might be in the git pull or git push are likely to encounter, this is because the two branches without relationship. So what's the solution?
Second, solutions
Behind the commands you add - allow - unrelated - nothing
for example:
git merge master - allow - unrelated - nothing

~/SpringSpace/newframe on  druid ⌚ 11:36:49
$ git merge master --allow-unrelated-histories
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.

If you are a git pull or git push to fatal: refusing to merge unrelated nothing
in the same way:
git pull origin master - allow - unrelated - nothing
and so on, this is the perfect solution to cough up!