2

I have 3 branch: main, test-1.1 and myName.
If I try to create pull request with myName and main, I will be able to do it:
enter image description here

But know, if I replace main with my test-1.1 branch, it gives me that:
enter image description here But, why ? I want to merge with test-1.1 but I am not able to.
How to resolve this ?

KAYZORK
  • 337
  • 1
  • 3
  • 17
  • Typical case of unrelated histories, as already pointed out by others. A rebase is what you would might need. [This other SO post](https://stackoverflow.com/questions/23344320/there-isnt-anything-to-compare-nothing-to-compare-branches-are-entirely-diffe) might help you. – Asif Kamran Malick Sep 24 '21 at 20:43
  • 1
    This one seems to have a clearer set of answers: https://stackoverflow.com/a/40107973/736079 – jessehouwing Sep 24 '21 at 20:53

2 Answers2

3

It looks like you have two branches that (no longer) share the same root-commit. Therefore, GitHub can't generate a Pull Request for you. Technically your two branches are totally unrelated (even if they contain similar content).

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • 2
    so, how can I resolve it ? – KAYZORK Sep 24 '21 at 20:45
  • 1
    from branch `myName` run `git pull origin test-1.1 --allow-unrelated-histories` or vice versa. https://reactgo.com/git-merge-unrelated-histories/ This will merge these branches back together locally. It looks like you'll then have to force-push. Make sure you havn backups. There be dragons. – jessehouwing Sep 24 '21 at 20:50
  • 1
    See: https://stackoverflow.com/a/40107973/736079 – jessehouwing Sep 24 '21 at 20:52
  • 1
    i had two branches unrelated branches with main and master, this is how it worked for me `git checkout master git branch main master -f git checkout main git push origin main -f ` – Jaideep Jul 03 '22 at 17:45
0

Do main, test-1.1, and myName all belong to the same branch?

To answer for your specific case, we'd need more information (what was on the branches) because github is comparing branches and telling you which ones can be merged and which cannot. If they can be merged, github is allowing you to create a pull request to merge myName into master. There must be 'merge conflicts' between the myName and test-1.1 branch.

Horus
  • 11
  • 3