不少人都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