在本地代码库添加原作者代码库的 remote 源,(操作一次就可以,以后不必每次添加)
git remote add upstream 原作者代码库地址 #upstream 表示上游代码库名称
获取原作者的更新
git fetch upstream
同步原作者的修改
git merge upstream/master
更新自己的远程代码库
git push
碰到的问题
1. 原作者新增了分支,但是自己的本地代码库没有这个分支
git checkout upstream/newBranch #检出原作者的新分支
git branch newBranch #在本地代码库新建 newBranch 分支
git push