github fork后怎样再更新

以neovim为例
https://github.com/neovim/neovim

1. clone一份代码到本地

git clone [email protected]:ckelsel/neovim.git

2. 添加upstream的url

cd neovim
git remote add upstream https://github.com/neovim/neovim

3. 确认添加成功

git remote -v
origin [email protected]:ckelsel/neovim.git (fetch)
origin [email protected]:ckelsel/neovim.git (push)
upstream https://github.com/neovim/neovim (fetch)
upstream https://github.com/neovim/neovim (push)

4.下载upstream的代码到本地

git fetch upstream
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 29 (delta 16), reused 18 (delta 16), pack-reused 10
Unpacking objects: 100% (29/29), done.
From https://github.com/neovim/neovim

  • [new branch] master -> upstream/master

5. 切换到master分支

git checkout master

6. 合并upstream的代码到master

git merge upstream/master

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

打赏

如果这篇文章解决了您的问题,让我买根烟抽抽。

github fork后怎样再更新_第1张图片
支付宝.jpg
github fork后怎样再更新_第2张图片
微信.jpg

你可能感兴趣的:(github fork后怎样再更新)