应用场景,多人合作开发项目的时候,我们要给别人的文件添加内容时候,首先要拉取别人的分支,下面是具体步骤
Administrator@AFOIH-1122 MINGW64 /d/api (master) $ git remote -v origin git@github.com:test/apis.git (fetch) origin git@github.com:test/apis.git (push) Administrator@AFOIH-1122 MINGW64 /d/api (master) $ git remote add upstream https://github.com/other/apis.git Administrator@AFOIH-1122 MINGW64 /d/api (master) $ git remote -v origin git@github.com:test/apis.git (fetch) origin git@github.com:test/apis.git (push) upstream https://github.com/other/apis.git (fetch) upstream https://github.com/other/apis.git (push) Administrator@AFOIH-1122 MINGW64 /d/api (master) $ git fetch upstream remote: Counting objects: 1, done. remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 Unpacking objects: 100% (1/1), done. From https://github.com/other/apis * [new branch] master -> upstream/master Administrator@AFOIH-1122 MINGW64 /d/api (master) $ git checkout master Already on 'master' Your branch is up-to-date with 'origin/master'. Administrator@AFOIH-1122 MINGW64 /d/api (master) $ git merge upstream/master Updating 177e46d..4c9fd1a Fast-forward