github同步、更新fork过来的代码

场景

源分支代码:https://github.com/microsoft/qlib

fork过来的代码:https://github.com/GaochaoZhu/qlib

例如:

我在1月份从【源分支】把代码fork到我个人github代码库;

在9月份的时候,我对qlib代码做了些更新,想要把更新后的代码merge到【源分支】;

此时【源分支】代码和我代码库的代码已经间隔8个月,【源分支】代码应该也变动了不小,那么就需要把【源分支】代码往我这边拉一下,确保代码最新;

应用

git remote add qlib https://github.com/microsoft/qlib

git fetch qlib

git merge qlib/main

(git commit -m 'xxx')  #  提交新代码需要commit,只是同步源分支的代码,则不需要此步

git push
原文地址:https://www.cnblogs.com/bigtreei/p/14960099.html