Can forks be synced automatically in gitHub?

最后都变了- 提交于 2019-11-27 09:51:52

问题


Stash enables automatic fork syncing if selected: https://confluence.atlassian.com/display/STASH/Keeping+forks+synchronized
It will update any branches in your fork that you haven't modified.

I've been unable to find similar automatic functionality in gitHub; all google searches are turning up manual ways to sync forks via your local cache.


回答1:


You could define a webhook to listen to upstream (the original repo) changes, and update your fork.

In June 2016, you now have the service backstroke.us which listens to those events for you. No need to write your own listener.
See 1egoman/backstroke

  1. Create a webhook in either a fork or a upstream repository. (Settings => Webhooks & Services => Add Webhook)
  2. Add http://backstroke.us as the payload url.
  3. Push some code to the upstream repository to see Backstroke in action.

In your case, you would need to convince the maintainer of the upstream repo (the one you have forked) to register that backstroke webhook.
You will see PR (pull requests) appear automatically on your fork, for you to accept (keeping you in sync with any evolution done on the original repo side).




回答2:


With GitHub alone, you cannot sync forks automatically. You can, however, sync forks manually.

You could also use the GitHub API to write a bot that syncs forks whenever upstream repositories are updated.




回答3:


You can create a Github App that use Github API to check the upstream repo periodically. Once an update is found, use Github API to create a pull request then call updateRef to update your branch to match master.

Or, just install this Github App that does exactly that

https://github.com/wei/pull

🤖 a GitHub App that keeps your repository up-to-date with upstream changes.




回答4:


You can import any public GitHub repository into GitLab, with an option to mirror future commits. You can do it with a few clicks. It's a great workflow for internal forks.



来源:https://stackoverflow.com/questions/23793062/can-forks-be-synced-automatically-in-github

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!