常梦网 常梦网

github同步fork别人的项目到自己的仓库

时间: 2024-05-17  热度:

github参考说明,英文好的直接看英文吧:

先保证有对fork的项目有一个远程分支

https://help.github.com/articles/configuring-a-remote-for-a-fork/

完成同步

https://help.github.com/articles/syncing-a-fork/

以下中文版本

当我们fork一个项目后,在我们使用代码的时候就会以我们本地为准,不会跟随我们fork前的项目,如果需要同步对方的代码,需要进行同步操作

ipandadeMBP:CMS ipanda$ git remote -vorigin    https://github.com/mpandar/CMS.git (fetch)origin    https://github.com/mpandar/CMS.git (push)
ipandadeMBP:CMS ipanda$ git remote add upstream https://github.com/BootstrapCMS/CMS.gitipandadeMBP:CMS ipanda$ git remote -vorigin    https://github.com/mpandar/CMS.git (fetch)origin    https://github.com/mpandar/CMS.git (push)upstream    https://github.com/BootstrapCMS/CMS.git (fetch)upstream    https://github.com/BootstrapCMS/CMS.git (push)
ipandadeMBP:CMS ipanda$ git fetch upstreamremote: Counting objects: 4, done.remote: Total 4 (delta 3), reused 3 (delta 3), pack-reused 1Unpacking objects: 100% (4/4), done.From https://github.com/BootstrapCMS/CMS * [new branch]      0.8        -> upstream/0.8 * [new branch]      master     -> upstream/master
ipandadeMBP:CMS ipanda$ git checkout master
ipandadeMBP:CMS ipanda$ git merge upstream/masterUpdating 569a184..eb4d63cFast-forward

Ok,即完成同步!

相关阅读