How To Merge Master And Main Branch In Github With Eclipse

Words
154
Reading
1 min
Listen
Play
5y

Hello,

here I describe how I merged two new and different branches in my github repository "Hamurabi".

The Problem

I have created a main branch by default.
But my code was uploaded into the "Master" branch.
Now I want to merge both, but I get a error message on github, when I try a merge request:
"main and master are entirely different commit histories."

This is what worked out:

In Eclipse, do your changes in the branch that you want to keep, commit them and then click on "push HEAD".
In the following dialog choose a different branch. Check "Force overwrite branch in remote if it exists and has diverged". Be aware that it deletes all files in the target branch. (Maybe you copy some needed files from target to source branch before):

I repeated this for the branch "Develop".

After that I was able to merge both (master and Develop) branches:

Regards, Achim

How To Merge Master And Main Branch In Github With Eclipse | Ecency