I have a template repository on GitHub with 3 branches:
feature/auth and the reason for that is because the code of the branch
feature/auth is optional depending on if the web application has authentication or not.
The problem I have is when I choose the option “Use this template” to generate new repositories and include all branches, then clone the new repository and merge
develop an error shows up:
fatal: refusing to merge unrelated histories
I tried running
git merge feature/auth --allow-unrelated-histories
But I got a lot of conflicts and I don’t want people who use the template to have to solve conflicts.
I don’t have this problem with the original repository, only with the template generated ones.
This are the steps to reproduce the issue:
- navigate to the template repository.
- click the option “Use this template”.
- fill the repository name field with any name you want and check the “Include all branches” checkbox, then click the “Create repository from template” button.
- after the new repository is generated, clone it to your computer.
- Enter the repository directory and run the following commands:
$ git fetch --all $ git checkout feature/auth $ git checkout develop $ git merge feature/auth
I’ve asked in StackOverflow and some other forums but got no help at all. Can somebody please help me with this?
Thank you very much in advance.