当前开发流程:分支开发,主干上线
举例:
先fork项目主干代码到个人仓库中
1) 当前项目仓库为(upstream):git@chegva.com:devops/example.git,主干分支为:upstream/master(为待上线分支)
2) 当前个人仓库为(anzhihe):git@:chegva.com:anzhihe/example.git,主干分支为:origin/master
操作:
1.创建个人相关信息,fork项目,然后clone到本地
git config --global user.name "your name"
git config --global user.email youremail@gmail.com
git clone git@:chegva.com:anzhihe/example.git
2.创建上游项目的远程连接
git remote add upstream git@chegva.com:devops/example.git
3.查看origin,upstream远程仓库信息
git remote -v
4.本地添加,编辑修改,然后commit
git add *
git ci -am "xxx"
5.更新上游项目,如果有冲突,解决冲突
git pull upstream master --rebase
6.提交代码到个人仓库
git push origin master
7.在页面发起merge request,找负责人合并代码
8.更新上游仓库,和项目仓库保持同步
git pull upstream master