Site down right now? Call or text, and I'll start the same day. (910) 338-4964
Randy Johnson
← All posts

GIT fatal: refusing to merge unrelated histories

This is a short and sweet post. I often will start a project by initializing my project with git locally: git init . I then went to GitHub and created the project there. I chose a license file since this was a public repository. That created the ini...

This is a short and sweet post. I often will start a project by initializing my project with git locally:

git init .

I then went to GitHub and created the project there. I chose a license file since this was a public repository.

That created the initial commit, adding the license file.

So, when I added the remote to my local repository, I had 2 separate main branches.

Turns out I lucked out this time because I was at the very beginning of my project.

The following command saved the day:

pull origin main --allow-unrelated-histories

I am not sure of the drawbacks of doing this, but at this stage of the project, I am not too worried about it.

More posts