- 打開
Terminal
,Windows 下用Git Bash
。 - 進入到本地倉庫目錄。
- 把想要同步的倉庫(就是被你
Fork
的倉庫)關聯到本地 upstream。
$ git remote add upstream https://github.com/*******.git(或者使用 ssh 方式)
- 查看遠程倉庫關聯狀態
$ remote -v
- 拉取遠程倉庫所有分支
$ git fetch upstream
- 把被 Fork 倉庫的代碼合併到本地 master 分支
$ git checkout master
$ git rebase upstream/master
- 現在你本地已經是最新的了,只需要
push
到你的遠程分支即可。