转载自:http://www.ericdai.cn/c/GIT使用场景化
场景一:仓库初始化
初始化仓库
mkdir gitRepo
cd gitRepo
git init
git clone http://gitlab.....
添加远程服务器
git remote add origin http://gitlab.......
创建多个主分支
git branch master
git branch dev
git branch test
查看已有分支
git branch
提交代码框架
git push origin master:master
git push origin dev:dev
场景二:功能开发与测试
创建功能分支
git checkout dev
git branch author_featureName_version
提交测试
git checkout test
git branch author_featureName_version_test
git checkout author_featureName_version_test
git pull origin author_featureName_version
功能交付提交
git checkout dev
git merge author_featureName_verison
git commit
git push origin dev:dev
场景三:版本发布
git checkout master
git pull origin dev:master
git push origin master:master
场景四:BUG修复
git checkout master
git branch bugfix_bugNo_author
git checkout bugfix_bugNo_author
git pull origin master:bugfix_bugNo_author
----修复后提交----
git push origin bugfix_bugNo_author:bugfix_bugNo_author
git checkout master
git merge bugfix_bugNo_author
git push origin master:master
场景五:紧急需求
git checkout master
git branch author_featureName_date
git checkout author_featureName_date
git pull origin master
--------完成后提交----------
git checkout master
git merge author_featureName_date
git push origin master:master
git checkout dev
git merge author_featureName_date
git push origin dev:dev