我有一个 React 项目的仓库。我想将该 repo 作为其他一些项目的“基础”,并将其用作起点。我还想根据“基础”的进展情况,使所有其他源自它的 repo 协议(protocol)保持最新。
我正在使用 Bitbucket 进行远程存储库托管,并在本地使用 Tower 作为一个不错的 GUI。
执行此操作的正确方法是在 Bitbucket 中 fork “基础”,然后在本地克隆它吗?本地 repo 是否会以任何方式了解“基本” repo 的更新?我怎么知道是否对“基本”存储库做出了重大 promise ,这将使任何 fork 的存储库受益?
或者,如果我对 fork 的存储库进行更改以使所有其他存储库受益,我是否可以执行 pull 请求以便“基础”存储库知道它应该 pull 更新?
请原谅我的无知,我目前根本没有使用 fork 或 pull 请求,我正在努力解决它:)
最佳答案
Will the local repo be aware of updates to the "base" repo in any way?
否:您需要添加一个远程,(通常)命名为上游,引用原始仓库
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
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?
是的,这将是一个典型的 pull 请求。
关于Git fork 和 pull 请求工作流程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51562124/