When you create a Github repository from a Template, there is no origin <> destination relationship. They live separate lives. This is different from Forking a repository. In that case the fork knows its origin, and you can sync your Fork from the origin.
I would like to update my repository from the original template though. Because that repository gets bug fixes, and I want to inherit them.
- The Original template repo: https://github.com/jancumps/pst_rtos
- My repository that's based on that template: https://github.com/jancumps/pst_rtos_xiao
I have been looking for solutions. I found a few custom Github actions that can do this. But they fail if there's a merge conflict. And because it's a job, you can't interactively resolve that. Then I found a solution on Stack Overflow that uses the git command. It worked for me:
I'm looking for feedback. Do you think that this will corrupt the pst_freertos_xiao repo?
The Stack Overflow page lists the side effects, and I've read them. It also has different suggestions, e.g.: patching ...
I started a command line, and navigated to the root of pst_rtos_xiao repository clone on my hard disk.
Then I executed these commands:
$ git pull
$ git remote add template https://github.com/jancumps/pst_rtos.git
$ git fetch --all
$ git merge template/main --allow-unrelated-histories
If merge conflicts occcur, this would be where you fix them.
$ git status
$ git add CMakeLists.txt
$ git add source/scpi/scpi-def.h
$ git commit -a -m "refreshing from template"
$ git push
This merged all changes in my oinline Github repo https://github.com/jancumps/pst_rtos_xiao. That was the goal.