-
Notifications
You must be signed in to change notification settings - Fork 2
Git操作 Git如何Fork后保持与上游仓库同步
bin4xin edited this page Apr 29, 2022
·
1 revision
Git如何Fork后保持与上游仓库同步
- 首先,确定你的仓库源地址(即fork后的地址),执行下面命令查看仓库路径
git remote -v
- 然后去配置原仓库的路径,即配置上游仓库的路径
git remote add upstream https://github.com/Bin4xin/bin4xin.github.io.git
- 抓取原仓库的修改文件
git fetch upstream
- 将你的本地仓库和上游仓库进行合并(若提示拒绝合并不相关的历史,可以用下面的这个指令)
git merge upstream/master --allow-unrelated-histories
此时,你的本地仓库就已经和上游仓库保持同步了,但是你fork下来的仓库,还在你的GitHub上保存着,并未受到影响,如果你想将你自己的远程仓库再和本地保持同步,只需要再push一下即可。
wiki 贡献者 Bin4xin • feifei1606 • codecat