1、在git 上fork 主仓库的项目
2、在本地 下载自己fork的项目:
$ git clone git@github.com:wangyy/TestProject.git -b dev
3、查看远程仓库地址:
$ git remote -v
origin git@github.com:wangyy/TestProject.git (fetch)
origin git@github.com:wangyy/TestProject.git (push)
4、添加主仓库地址
$ git remote add test git@github.com:test/TestProject.git
5、再次查看远程仓库地址:
origin git@github.com:wangyy/TestProject.git (fetch)
origin git@github.com:wangyy/TestProject.git (push)
test git@github.com:test/TestProject.git (fetch)
test git@github.com:test/TestProject.git (push)
6、本地修改代码实现功能,通过git add、git commit 提交修改到本地仓库
7、从主仓库更新最新代码,和本地代码合并,解决冲突
$git pull test dev
有时候不会自动合并,使用git fetch、git merge
$git fetch test dev
$git merge test/dev # 当前在origin/dev 分支
8、将本地代码提交到fork项目的分支上
$git push origin dev
9、向主仓库发起pull request请求
10、主仓库管理员合并Pull request