Github fork sync upstream
標(biāo)簽(空格分隔): git
使用場(chǎng)景
- fork repo
- 遠(yuǎn)程分支有改動(dòng)十酣,需要同步到fork repo上
關(guān)聯(lián)遠(yuǎn)程分支
## 查看遠(yuǎn)程分支
$ git rmeote -v
## 關(guān)聯(lián)遠(yuǎn)程分支
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
同步遠(yuǎn)程分支
## 拉去遠(yuǎn)程分支改動(dòng)到本地
git fetch upstream
## 切換到本地的主分支
git checkout main(master) 自己repo的主分支涩拙,這個(gè)分支和遠(yuǎn)程分支對(duì)應(yīng)
## 本地的分支合并遠(yuǎn)程分支的改動(dòng)
git merge upstream/main