git remote -v
查看远程状态。git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
git remote -v
# origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
# origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
# upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
# upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
upstream/master
git fetch upstream
git checkout master
upstream/master
分支合并到本地 master
上,这样就完成了同步,并且不会丢掉本地修改的内容。git merge upstream/master
如果想更新到 GitHub 的 fork 上,直接 git push origin master
就好了。