Git分叉和请求请求工作流程 [英] Git forking and pull-request workflow

查看:88
本文介绍了Git分叉和请求请求工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个React项目的仓库.我想将该仓库作为其他一些项目的基础",并以此为起点.我还想根据基准"的情况,使所有其他来自它的存储库保持最新状态.

I have a repo of a react project. I'd like to take that repo as the "base" of a few other projects and use it as a starting point. I'd also like to keep all of the other repos which stem from it up-to-date based on what the "base" has going on.

我正在使用Bitbucket进行远程回购托管,并在本地使用Tower作为一个不错的GUI.

I am using Bitbucket for remote repo hosting and Tower locally as a nice GUI.

执行此操作的正确方法是在Bitbucket中派生基础",然后在本地克隆它吗?本地存储库是否会以任何方式知道对基本"存储库的更新?我怎么知道是否对基础"回购作出了重大承诺,这将使任何分叉的回购都受益?

Is the correct way to do this is fork the "base" in Bitbucket, and then clone it locally? Will the local repo be aware of updates to the "base" repo in any way? How would I know if a significant commit has been made to the "base" repo which would benefit any of the forked repos?

或者,如果我对派生的repo进行了更改以使其他所有repo都受益,那么我可以执行一次pull-request,以便基本" repo知道它应该获取更新吗?

Alternately, if I make a change to the forked repo that would benefit all of the other repos, can I do a pull-request so the "base" repo knows that it should pull in the updates?

请原谅所有的无知,我目前还没有使用过分叉或请求请求,而是试图绕开它:)

Please excuse any ignorance, I've not used forking or pull-requests at all at this time and am trying to get my head around it :)

推荐答案

本地存储库是否会以任何方式知道对基本"存储库的更新?

Will the local repo be aware of updates to the "base" repo in any way?

否:您将需要添加一个上游(通常是上游),并引用原始存储库

No: you will need to add a remote, named (usually) upstream, referencing the original repo

cd /path/to/local/clone/of/fork
git remote add upstream /url/original/repo

git checkout master

# detailed step:
git fetch upstream
git merge upstream/master

# or (shorter)
git pull upstream master

或者,如果我对派生的repo进行了更改以使其他所有repo都受益,那么我可以执行一次pull-request,以便基本" repo知道它应该获取更新吗?

Alternately, if I make a change to the forked repo that would benefit all of the other repos, can I do a pull-request so the "base" repo knows that it should pull in the updates?

是的,这是经典的拉取请求.

Yes, that would be a classic pull request.

这篇关于Git分叉和请求请求工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆