两种方式根据实际情况选择使用。
方式一(fetch+merge)
上游源统一命名为upstream
#关联远程remote,远程源命名为upstream
git remote add upstream <ssh或https地址>
#取消push,本质上是修改url
git remote set-url --push upstream no_push
#拉取远程分支代码,branch是你要的分支
git fetch upstream <branch>
#合并代码
git merge upstream/<branch>
方式二(pull)
方便,但是有时候不好用
#关联远程remote,远程源命名为upstream
git remote add upstream <ssh或https地址>
git pull upstream