How to automatically align/sync a forked Github origin/master branch to upstream/master?
Asked Answered
N

3

13

Is there a way to automatically sync my forked Github repository's remote master branch (origin/master) to an original Github repository's master branch? (upstream/master)

I ask because I would like my forked remote origin/master branch on Github to always stay up-to-date so that I could save time by not needing to continually pull / rebase & push upstream repository changes into my forked repo's master branch.

Norvell answered 20/2, 2015 at 23:1 Comment(2)
Possible duplicate of Can forks be synced automatically in gitHub?Aleph
Here is a Github App that solves your problem : ) github.com/wei/pull 🤖 a GitHub App that keeps your repository up-to-date with upstream changes.Fordham
K
7

It is very easy to sync forked repository but question is how ?

In this example i am using WorldMapGenerator Repository

Go to your forked repository, you can see setting button click on it.

enter image description here

After clicking on setting button you can see Webhooks & services option in left menu click on it.

enter image description here

Then you can see Add Webhook Button on right side just click on it.

enter image description here

After clicking Add Webhook Button, details page will get open, so in detail page yo can see payload url. Enter http://backstroke.us url in it.

enter image description here

Now If any commit goes in main repository, then pull request will come in your forked repository.

That's it enjoy :)

For more details https://github.com/1egoman/backstroke

Knurl answered 6/8, 2016 at 8:20 Comment(2)
When you say Enter http://backstroke.us url in it, it is the https://backstroke.us/_5a4ds65f46464s65d4654 URL, or just http://backstroke.us?Deuteranope
Great! Your proprietary solution didn't even last 2 years. Great job, buddy!Rectifier
C
5

GitHub does not have such an automatic sync feature. However, it is trivial to add as a cron job on a server so that you don't have to do it manually. For instance:

cd /srv/mirrorrepo ; git fetch upstream master ; git push origin master
Cally answered 21/2, 2015 at 23:8 Comment(0)
D
3

Updating the @Keval Bhatt answer:

There are two versions of Backstroke:

Backstroke Classic, the original version. It was made originally by me about a year ago and is deprecated, however others have posted about it online. In order to set this up, the user adds https://backstroke.us as a webhook in their repository manually.

Backstroke, the newer version of Backstroke. This has a dashboard the user can use to setup Backstroke, no manually-adding of webhooks required. The url https://backstroke.us/_5a4ds65f46464s65d4654 is the webhook that gets added behind the scenes to your repository, but you never have to call it yourself unless you want to tie Backstroke into some custom system. If you just want to sync changes from one repo to another, then you don't have to think about the webhook since it's managed by the system.

https://github.com/1egoman/backstroke/issues/60#issuecomment-318923158

Now you only need to access https://backstroke.us, login and add the links between the repositories, and the pull requests are created automatically:

  1. enter image description here
  2. enter image description here

Behind the scenes, https://backstroke.us will be setting up the GitHub webhooks to automatically pull updates with the https://backstroke.us website interface.

Deuteranope answered 30/7, 2017 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.