github上fork别人的代码之后,保持和原作者同步的更新

  1. 查看git已经有的源分支
git remote -v

结果如下:

origin  https://github.com/weblazy/utils.git (fetch)
origin  https://github.com/weblazy/utils.git (push)
  1. 添加原库的源分支并命名为web
git remote add web https://github.com/weblazy/utils.git
  1. 查看git已经有的源分支
git remote -v

结果如下:

origin  https://github.com/weblazy/utils.git (fetch)
origin  https://github.com/weblazy/utils.git (push)
web     https://github.com/weblazy/utils.git (fetch)
web     https://github.com/weblazy/utils.git (push)
  1. 原库拉取远程分支
git fetch web

结果如下:

来自 https://github.com/weblazy/utils
 * [新分支]          master     -> web/master

5.查看所有分支

git branch -a

结果如下:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/web/master

6.本地master分支合并原库master分支

git merge web/master
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容