美文网首页
Github fork 仓库与原仓库同步

Github fork 仓库与原仓库同步

作者: iVikings | 来源:发表于2021-10-20 16:29 被阅读0次
  • 进入 fork 项目目录,查看你的远程仓库路径
git remote -v
origin  https://github.com/YOUR_UERNAME/YOUR_FORK.git (fetch)
origin  https://github.com/YOUR_UERNAME/YOUR_FORK.git (push)
  • 配置原仓库路径
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
  • 再次查看远程目录位置
git remote -v
origin  https://github.com/YOUR_UERNAME/YOUR_FORK.git (fetch)
origin  https://github.com/YOUR_UERNAME/YOUR_FORK.git (push)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
  • 抓取原仓库的修改文件
git fetch upstream
  • 切换到 master 分支
git checkout master
  • 合并远程的 master 分支
git merge upstream/master

相关文章

网友评论

      本文标题:Github fork 仓库与原仓库同步

      本文链接:https://www.haomeiwen.com/subject/giitaltx.html