Github项目fork后怎么更新

用命令行,流程如下:

先判断是否建立了主repo的远程源:

1
git remote -v

如果里面只能看到你自己的两个源(fetch 和 push)。

1
2
origin   url(fetch)
origin url(push)

那就需要添加主repo的源:

1
2
git remote add upstream URL
git remote -v

然后你就能看到upstream了。

1
2
3
4
origin   url(fetch)
origin url(push)
upstream url(fetch)
upstream url(push)

如果想与主repo合并:

1
2
git fetch upstream
git merge upstream/master

版权所有,如有侵权请联系我