赞
踩
要让fork的仓库与原仓库保持同步,主要有两种方法:
1、打开pull request
2、转换分支,让原仓库向你fork的仓库发出pull request请求
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。