feedforward 发表于 2022-6-5 19:40:37

github更新线上fork的仓库

fork到自己的仓库后,后续正式版本标签就不同步到该仓库了,我们想在本地切换到最新的release版本就比较麻烦,我们需要跟新fork库
1、查看upstream和origin设置是否正确:git remote -v

origin    https://ghp_ojEjyPi1Kq6NcRlIk1WydsU4adN@github.com/zouboan/incubator-nuttx.git (fetch)
origin    https://ghp_ojEjyPi1Kq6NcRlIk1WydsU4adN@github.com/zouboan/incubator-nuttx.git (push)
upstream    https://github.com/zouboan/incubator-nuttx.git (fetch)
upstream    https://github.com/zouboan/incubator-nuttx.git (push)

可见upstream不正确,需要重新设置
2、 设置upstream:git remote add upstream https://github.com/apache/incubator-nuttx.git
结果报错了:fatal: remote upstream already exists.
我们需要删除它重新设置:
git remote rm upstream
git remote add upstream https://github.com/apache/incubator-nuttx.git

重新查看:git remote -v   结果如下:
origin    https://ghp_ojEjyPi1Kq6NcRlIk1WydsU4adN@github.com/zouboan/incubator-nuttx.git (fetch)
origin    https://ghp_ojEjyPi1Kq6NcRlIk1WydsU4adN@github.com/zouboan/incubator-nuttx.git (push)
upstream    https://github.com/apache/incubator-nuttx.git (fetch)
upstream    https://github.com/apache/incubator-nuttx.git (push)
这次对了

3、fetch源分支的新版本到本地>    git fetch upstream4、合并两个版本的代码    git merge upstream/master5、将合并后的代码push到github上去   git push origin master

页: [1]
查看完整版本: github更新线上fork的仓库