美文网首页
git hub fork并同步原始仓库

git hub fork并同步原始仓库

作者: BenjaminU | 来源:发表于2020-03-31 10:47 被阅读0次

origin仓库:fork来源仓库
upstream仓库:fork以后的仓库
local仓库:下载到本地的仓库

查看当前分支的关联仓库:

git remote -v
origin  https://github.com/origin.git (fetch) #origin.git 为fork以后的git地址
origin  https://github.com/origin.git (push) #origin.git 为fork以后的git地址
upstream    https://github.com/upstream.git (fetch) #origin.git 为upstream以前的git地址
upstream    https://github.com/upstream.git (push) #origin.git 为upstream以前的git地址

或git remote show 会显示远程仓库信息,比如 origin 或者 upstream
git remote show origin
git remote show upstream

git本地仓库添加到远程仓库

git remote add upstream https://github.com/upstream.git #upstream.git 为fork以前的git地址

git 同步upstream、origin、local仓库:

1. 同步upstream 到分支master:
git pull upstream master
2. 同步local到origin:
git push
3. 添加修改的代码xxx:
git add xxx
git commit -m "infor" #infor为添加代码的说明
git push
4. 同步修改的代码xxx到upstream:
a. 进入github origin分支,提交pull request‘
b. 将request连接发送给有权限merge人员进行merge

相关文章

网友评论

      本文标题:git hub fork并同步原始仓库

      本文链接:https://www.haomeiwen.com/subject/dgoiuhtx.html