惊天一问:fork 了别人的仓库后,原作者又更新了仓库,如何将自己的代码和原仓库保持一致呢?
git remote -v
查看远程状态。
git remote -v
# origin https://github.com/shengjk/flink.git (fetch)
# origin https://github.com/shengjk/flink.git (push)
git remote add upstream https://github.com/apache/flink.git
git remote -v
origin https://github.com/shengjk/flink.git (fetch)
origin https://github.com/shengjk/flink.git (push)
upstream https://github.com/apache/flink.git (fetch)
upstream https://github.com/apache/flink.git (push)
git fetch upstream
git fetch upstream
remote: Enumerating objects: 192, done.
remote: Counting objects: 100% (192/192), done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 232 (delta 61), reused 189 (delta 60), pack-reused 40
Receiving objects: 100% (232/232), 42.32 KiB | 147.00 KiB/s, done.
Resolving deltas: 100% (61/61), completed with 24 local objects.
From https://github.com/apache/flink
0ab1549f52..3cbaabc527 master -> upstream/master
de3772bfd2..1b9c464ab3 release-1.6 -> upstream/release-1.6
c193cf04a4..8012ab17bc release-1.7 -> upstream/release-1.7
git checkout master
git checkout master
# Switched to branch 'master'
git merge upstream/master
git merge upstream/master
git push origin master
就好了。扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有