Fork Pull Request模型的开发流程

1,369 阅读1分钟

概念部分

  • 公仓: git项目的源仓库
  • 私仓: 从公仓fork到个人的git仓库地址

Fork 项目

在git项目的源仓库点击Fork,就可以fork到个人仓库了。

更新公仓源码

查看目前仓库可以更新的远程git信息,是否有公仓git

  • git remote -v

配置公仓git地址,ps:upstream为自定义名字和orgin作用相同,sourcetree也会同步更新

  • git remote add [upstream] [url]

拉取公仓源码

  • git fetch upstream

合并公仓源码

  • git merge upstream/master

push到私仓

  • git push

同步公仓新增分支

本地创建一个基于新增主仓分支的新分支

  • git checkout -b [new-branch-name] upstream/[new-branch-name]

push到私仓远端

  • git push origin [new-branch-name]