質問

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).

役に立ちましたか?

解決

First, you need to make sure your default pushing policy is set to matching, in order to push all local branches to their respective matching upstream branches.

git push project-community # will push all matching branches

Second, you need a clone of your repo which has all the remote branches tracked locally: See "Track all remote git branches as local branches".

Third, you will need to update all local branches from all remote branches:
See "Can I easily update all local git branches from remote branches simultaneously?".

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top