且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git分叉和请求请求工作流程

更新时间:2022-04-26 22:08:40

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

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.