多人工作过程中如何正确使用git
-
假定仓库中有master,dev,feature分支,日常开发使用feature分支,dev测试分支,master线上分支
- gitee上创建一个Test仓库进行模拟测试
- 仓库上创建一个index.php
-
同时开启多个命令行模拟多用户进行提交
- gitee上创建一个Test仓库进行模拟测试
- 开发人员开启上班模式
- git clone 指定的git仓库地址
- git clone git@gitee.com:ywjmylove/test.git
- git clone 指定的git仓库地址
-
- 创建本地分支并且和远程分支进行绑定
- git checkout -b myfeature origin/feature
-
git branch -a
- 创建本地分支并且和远程分支进行绑定
-
- 进行修改之前,先更新本地(不建议使用git pull 具体原因百度)
- git fetch origin feature
- git merge origin/feature
- 疯狂输出代码
- git commit -am 'message'
- 查看当前的commit的次数,并合并commit
-
git rebase -i HEAD~2 (将第二个pick改成s)
- 进行修改之前,先更新本地(不建议使用git pull 具体原因百度)
-
- 提交前再次进行一次fetch的操作
- git fetch origin feature
- 提交前再次进行一次fetch的操作
-
- 将本地的修改合并远程仓库
- git rebase origin/feature
- 将本地的修改提交到远程
- git push origin myfeature
- 提交合并的申请(默认你没有merge feature的权限)
- 主管开始合并申请,最后删除申请分支
- git checkout -b myfeature origin/myfeature
- git checkout feature
- git merge feature
- git push origin feature
- git push origin --delete myfeature
- 查看commit是不是就很nice
-
- 将本地的修改合并远程仓库