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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.