简体   繁体   English

为 github 创建一个公共 git repo 的分支

[英]Create a fork of public git repo for github

I'm just starting to use git and github and I need some advise.我刚刚开始使用 git 和 github,我需要一些建议。 I want to create a fork of a public git repo (qemu-kvm in case you're interested).我想创建一个公共 git 存储库的分支(如果您感兴趣,可以使用 qemu-kvm)。 I plan to have a public version of the fork on github and a development version for our team.我计划在 github 上有一个公共版本的 fork,并为我们的团队提供一个开发版本。

I'm sure there are many ways to set this up, but git confuses me sometimes.我确信有很多方法可以设置它,但是 git 有时让我感到困惑。 What I'm thinking of doing is ...我想做的是...

Create a clone of the qemu-kvm repo on my development machine in a special official branch.在我的开发机器上的一个特殊官方分支中创建 qemu-kvm 存储库的克隆。 Allow the team to clone this repo and commit changes into the master branch.允许团队克隆这个 repo 并将更改提交到 master 分支。 When the master branch is stable, I would merge the code to a github branch and use this to update the code on github.当 master 分支稳定后,我会将代码合并到一个 github 分支并使用它来更新 github 上的代码。

Periodically, I would fetch changes on the official branch and merge them to my github branch as required.我会定期在官方分支上获取更改,并根据需要将它们合并到我的 github 分支。

Does this sound sensible or is there a better way to do this?这听起来合理还是有更好的方法来做到这一点? Thanks, Steve谢谢,史蒂夫

It can work, but you need to manage a special clone on your local environment.它可以工作,但您需要在本地环境中管理一个特殊的克隆。

You could simply publish on your fork a ' dev ' branch and ask your developer to push directly in that branch of your fork (adding the developers as collaborators)您可以简单地在您的 fork 上发布一个“ dev ”分支,并要求您的开发人员直接推送您的 fork 的该分支(将开发人员添加为合作者)

You would be in charge of cloning that GitHub fork and merging dev to master , making sure it is stable and based on the latest of master from the original repo (so rebasing your master branch on top of upstream/master , a bit like in " My pull request has been merged, what to do next? ").您将负责克隆该 GitHub 分支并将dev合并到master ,确保它稳定并基于原始存储库中 master 的最新版本(因此将 master 分支重新建立在upstream/master之上,有点像“我的拉取请求已合并,下一步该怎么做? ”)。
Then you can push master to your fork and make the pull request.然后你可以将master推送到你的叉子并发出拉取请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM