不少人都fork過,此時如果源倉庫(你fork的那個倉庫)有了新的提交,此時如何把新的提交也同步的fork過來?
這裏有github的原文,能夠直接看。也能夠往下看
[Syncing a fork]: https://help.github.com/en/articles/syncing-a-forkgit
注:先把fork的倉庫clone到你本地。下面的都是基於本地倉庫操做的!github
$ git remote -v > origin https://github.com/YOUR_USERNAME/你的fork倉庫.git (fetch) > origin https://github.com/YOUR_USERNAME/你的fork倉庫.git (push)
$ git remote add upstream https://github.com/ORIGINAL_OWNER/源倉庫.git
$ git remote -v > origin https://github.com/YOUR_USERNAME/你的fork倉庫.git (fetch) > origin https://github.com/YOUR_USERNAME/你的fork倉庫.git (push) > upstream https://github.com/ORIGINAL_OWNER/源倉庫.git (fetch) > upstream https://github.com/ORIGINAL_OWNER/源倉庫.git (push)
$ git fetch upstream > remote: Counting objects: 75, done. > remote: Compressing objects: 100% (53/53), done. > remote: Total 62 (delta 27), reused 44 (delta 9) > Unpacking objects: 100% (62/62), done. > From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY> * [new branch] master -> upstream/master
$ git checkout master > Switched to branch 'master'
$ git merge upstream/master > Updating a422352..5fdff0f > Fast-forward > README | 9 ------- > README.md | 7 ++++++ > 2 files changed, 7 insertions(+), 9 deletions(-) > delete mode 100644 README > create mode 100644 README.md
經過這個也要反思一下。很早以前我就會fork別人的倉庫,可是別人整個倉庫的內容,並非fork一下就全學會了的。fetch