Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,062
Community Members
 
Community Events
165
Community Groups

Not able to merge two branches

Hi Team,

We are trying to merge two branches in a repository, where we are getting below issue.

Git failed with a fatal error.
Git failed with a fatal error.
fatal: refusing to merge unrelated histories.

The scenario is 

We have two repositories kcapp and kcresourceplanning, taken a branch from kcapp and moved to kcresourceplanning. where we already have some branches over there.

But when we are trying merge the branches we are getting above issue.

Can you please look into this and help us.

1 answer

0 votes

Hi @KC-JR and welcome to the community.

By default, git merge command refuses to merge histories that do not share a common ancestor. If you take a branch from one repository and move it to another repository that is not a fork, this branch will not have a common ancestor with any branch of the repo where you moved it.

It is possible to override this behavior by using the option --allow-unrelated-histories in the git merge command. You will need to do the merge locally with a command like the following, and then push to Bitbucket:

git merge <branch_name> --allow-unrelated-histories

You can find more info about this option on the git merge documentation page, if you search for the option --allow-unrelated-histories:

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,255 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you