Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.3k views
in Technique[技术] by (71.8m points)

git bash - How to merge branches with entirely different commit histories in Github?

I wanted to give Github a try, so I create an account. To train myself, I created a remote repository, cloned into a folder on my computer, and experimented how to push a file I modified to the remote repository. For this, everything is fine.

Now comes the trouble: to experiment further, I created another remote repository, to which I want to push some code from a local repository. The push operation seems to be fine, as the pictures here below show

Picture 1

Picture 2

As you can see, the branch in my remote repository is called "main", and the branch in my local repository is called "master". The problem is when I try to make the changes effective in the remote repository (i.e. when I try to merge "master" into "main" by clicking the "Compare & pull request" button, if I express myself correctly ?), Github tells me that

There isn’t anything to compare. main and master are entirely different commit histories.

Picture 3

hence I cannot put the changes online. Can someone explain me how to solve that problem ?

N.B.: I use Git Bash to have a command line to execute the operations

question from:https://stackoverflow.com/questions/66049120/how-to-merge-branches-with-entirely-different-commit-histories-in-github

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...