GitHub —— fork的仓库与原仓库保持同步
·
要让fork的仓库与原仓库保持同步,主要有两种方法:
一、反向Pull Request
1、打开pull request
2、转换分支,让原仓库向你fork的仓库发出pull request请求
二、配置upstream指向fork的原仓库
1、查看现有的远程仓库:
$ git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
2、添加指向原仓库的upstream:
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
3、查看origin和upstream
$ git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
4、直接从原仓库的master分支拉取代码并直接合并代码,其中pull=fetch+merge.
git pull upstream master
更多推荐
已为社区贡献8条内容
所有评论(0)