Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub - Pull changes from a template repository

Tags:

github

I have created a Template Repository in GitHub and then created some repositories based on the template. Since they were created, there have been updates to the template that I want to pull into those repositories.

Is this possible?

like image 334
Matthew Layton Avatar asked Jun 13 '19 09:06

Matthew Layton


People also ask

How do I update a template in GitHub?

If you want to merge changes from a template into your project, you're going to need to fetch all of the missing commits from the template, and apply them to your own repo.

How do I use GitHub repository templates?

Just navigate to the Settings page and then click on the 'Template repository' checkbox. Once the template repository is created anyone who has access to it will be able to generate a new repository with same directory structure and files via 'Use this template' button.

How do I create a pull request template?

The easiest way to add a pull request template to your repository is by adding a file called pull_request_template.md in the root of your directory. It's a markdown file, so you can use any of the markdown that is available to you. More about markdown in the mastering markdown syntax guide.


1 Answers

On the other repositories you have to add this template repository as a remote.

git remote add template [URL of the template repo] 

Then run git fetch to update the changes

git fetch --all 

Then is possible to merge another branch from the new remote to your current one.

git merge template/[branch to merge] 

https://help.github.com/en/articles/adding-a-remote

like image 131
Daniel Doblado Avatar answered Oct 06 '22 14:10

Daniel Doblado