2

Let's assume that there are two repositories, one called project, the other project-community on the same Github account. I'd now like to make the project-community repository a mirror of the project repository. The purpose is that community members of the project can submit patches and other code to the community repository without the maintainer of the project having to take any care of stability issues etc. How would I do that?

I thought I'd simply clone the repository, add a new remote and then regularly git pull project and git push project-community. This works quite nice for the first try but I have the issues that I only have the master branch in the community repository afterwards. What's the correct way to push all the changes to all the branches without creating a local copy of each branch?

I took a look at the --mirror option but this does not seem to be useful as the project structure is not the same anymore (there are now first-level directories added by git).

4

1 回答 1

2

首先,您需要确保您的默认推送策略设置为matching,以便将所有本地分支推送到它们各自匹配的上游分支

git push project-community # will push all matching branches

其次,您需要一个在本地跟踪所有远程分支的 repo 的克隆:请参阅“将所有远程 git 分支跟踪为本地分支”。

第三,您需要从所有远程分支更新所有本地分支:
请参阅“我可以同时从远程分支轻松更新所有本地 git 分支吗? ”。

于 2013-10-27T19:30:09.437 回答