You can use --allow-unrelated-histories to force the merge to happen.

The reason behind this is that default behavior has changed since Git 2.9:

"git merge" used to allow merging two branches that have no common base by default, which led to a brand new history of an existing project created and then get pulled by an unsuspecting maintainer, which allowed an unnecessary parallel history merged into the existing project. The command has been taught not to allow this by default, with an escape hatch --allow-unrelated-histories option to be used in a rare event that merges histories of two projects that started their lives independently.

See the Git release changelog for more information.

More information can be found in this answer.

Answer from blue112 on Stack Overflow
🌐
Mark Pelf
markpelf.com › 1437 › git-error-refusing-to-merge-unrelated-histories
Git – Error: refusing to merge unrelated histories - Mark Pelf - Blog
August 3, 2022 - Explanation of problem and instructions are at [2]. We need to run “git merge <branch-name> --allow-unrelated-histories” · So, you can open GitBash from SourceTree (Terminal button), and execute the command.
Discussions

bitbucket - GIT Fatal : refusing to merge unrelated histories - Stack Overflow
$ git pull origin master From https://bitbucket.org/tecgenome/chl-v2.0-html * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories How can I avoid or get pas... More on stackoverflow.com
🌐 stackoverflow.com
Subtree pull shows "fatal: refusing to merge unrelated histories”
With older version of Sourcetree / git, this step was executed properly. Any idea how to fix this? More on community.atlassian.com
🌐 community.atlassian.com
January 5, 2021
How to deal with "refusing to merge unrelated histories" error
Short version of my question : For years, I have been using a simple, single one-branch, one-contributor public online Github repo. A few days ago my computer died suddenly and I bought a new one. ... More on github.com
🌐 github.com
19
104
Sourcetree error when trying to pull from reposito...
There's not a way to resolve this within Sourcetree's UI but it seems like this thread has some helpful suggestions for a CLI solution: https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase. More on community.atlassian.com
🌐 community.atlassian.com
April 5, 2018
🌐
OneUptime
oneuptime.com › home › blog › how to fix 'fatal: refusing to merge unrelated histories'
How to Fix 'Fatal: refusing to merge unrelated histories'
January 24, 2026 - # Pull with unrelated histories ... --abort · The "refusing to merge unrelated histories" error protects you from accidentally combining separate projects....
🌐
Komodor
komodor.com › home › articles › how to fix ‘fatal: refusing to merge unrelated histories’ git error
How to fix 'fatal: refusing to merge unrelated histories' Git error
September 15, 2025 - The alternative (and longer) way of fixing the fatal: refusing to merge unrelated histories issues is to unstage your current commits, stash them, clone your required remote repository, and then place your stashed branch contents into the new clone.
🌐
C# Corner
c-sharpcorner.com › article › git-error-refusing-to-merge-unrelated-histories
Git - Error - Refusing To Merge Unrelated Histories
August 15, 2022 - An explanation of the problem and instructions are at [2]. We need to run “git merge <branch-name> --allow-unrelated-histories." So, you can open GitBash from SourceTree (Terminal button), and execute the command.
🌐
Datree
datree.io › resources › git-error-fatal-refusing-to-merge-unrelated-histories
Fix Git Error - Fatal: refusing to merge unrelated histories - Datree.io | Datree.io
November 21, 2019 - When a user action (like git merge) can cause rewriting of the history data, Git throws errors in part to ensure the user fully understands what they are doing. In short, the solution is to use the flag --allow-unrelated-histories.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › git › how-to-fix-git-refusing-to-merge-unrelated-histories
How to Fix Git “Refusing to Merge Unrelated Histories”? - GeeksforGeeks
July 23, 2025 - When two repositories or branches do not share any commits, Git treats them as having unrelated histories and refuses to merge them by default to prevent potential conflicts and confusion.
🌐
Career Karma
careerkarma.com › blog › git › how to solve fatal: refusing to merge unrelated histories
How to Solve fatal: refusing to merge unrelated histories | Career Karma
December 1, 2023 - The fatal: refusing to merge unrelated histories git error can be resolved using the --allow-unrelated-histories flag. On Career Karma, learn how to resolve this common error.
🌐
YouTube
youtube.com › gina sprint
How to Fix the Git Error "fatal: refusing to merge unrelated histories." - YouTube
In this video I explain why you are getting the "fatal: refusing to merge unrelated histories" Git error when you try to push to Github and I show you two wa...
Published   February 9, 2020
Views   1K
🌐
Datafloq
datafloq.com › home › what is the ‘fatal: refusing to merge unrelated histories’ error?
What is the 'Fatal: refusing to merge unrelated histories' error? |
March 10, 2023 - In all these instances, Git does not have the necessary information to understand the structure and content of the repositories, which leads to this error. The simplest method to deal with this error is to use the –allow-unrelated-histories option.
🌐
CodeProject
codeproject.com › Tips › 5339590 › Git-Error-Refusing-to-Merge-Unrelated-Histories
Git – Error: Refusing to Merge Unrelated Histories
August 12, 2022 - Disclaimer: References to any specific company, product or services on this Site are not controlled by GoDaddy.com LLC and do not constitute or imply its association with or endorsement of third party advertisers
🌐
DEV Community
dev.to › abisaifredrick › fatal-refusing-to-merge-unrelated-histories-3bb4
fatal: refusing to merge unrelated histories - DEV Community
August 12, 2024 - Create a new empty commit that connects unrelated branches then merge those branches. ... When setting up a new repository, it’s advisable to initialize it using an existing project.
🌐
Educative
educative.io › answers › the-fatal-refusing-to-merge-unrelated-histories-git-error
The “fatal: refusing to merge unrelated histories” Git error
The “fatal: refusing to merge unrelated histories” Git error occurs when two unrelated projects are merged (i.e., projects that are not aware of each other’s existence and have mismatching commit histories).
🌐
Git Tower
git-tower.com › learn › git faq › how to fix "fatal: refusing to merge unrelated histories" in git
How to Fix "fatal: refusing to merge unrelated histories" in Git | Learn Version Control with Git
2 days ago - It is good practice to first ... so, the solution is simple. To fix the error, you can use the --allow-unrelated-histories option when running the git merge command....
🌐
Atlassian Community
community.atlassian.com › q&a › sourcetree › questions › sourcetree error when trying to pull from repository
Sourcetree error when trying to pull from reposito...
April 5, 2018 - There's not a way to resolve this within Sourcetree's UI but it seems like this thread has some helpful suggestions for a CLI solution: https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase.
🌐
Medium
sahilali.medium.com › understanding-and-resolving-fatal-refusing-to-merge-unrelated-histories-in-git-8701d07624c5
Understanding and Resolving “fatal: refusing to merge unrelated histories” in Git | by Sahil Ali | Medium
September 30, 2023 - The “fatal: refusing to merge ... a Git merge operation. It occurs when Git detects that the branches you are attempting to merge have diverged significantly and lack a common ancestor commit....
🌐
GitHub
github.com › trilbymedia › grav-plugin-git-sync › issues › 61
fatal: refusing to merge unrelated histories · Issue #61 · trilbymedia/grav-plugin-git-sync
August 16, 2017 - [2017-08-16 16:40:11] grav.NOTICE: gitsync[command]: git -C "D:/xampp/htdocs/flat-file-cms/grav-admin/user/" fetch origin master 2>&1 [] [] [2017-08-16 16:40:12] grav.NOTICE: gitsync[output]: From https://bitbucket.org/tarmo888/grav-copy * branch master -> FETCH_HEAD [] [] [2017-08-16 16:40:13] grav.NOTICE: gitsync[command]: git -C "D:/xampp/htdocs/flat-file-cms/grav-admin/user/" pull -X theirs origin master 2>&1 [] [] [2017-08-16 16:40:14] grav.NOTICE: gitsync[output]: From https://bitbucket.org/tarmo888/grav-copy * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories [] [] Running git pull origin master --allow-unrelated-histories and writing a message for the master branch merge gets rid of that error.
Author   trilbymedia