First, the cooperation process reference
Ii. Introduction of Branches
Master Branch: always in a stable state, this branch code can be used at any time to deploy. You are not allowed to submit code directly on this branch.
Develop branch: Development Branch, if you want to add a new feature, pull out a branch from the Master branch, and the branch name convention is develop/xxx
Third, the specific operation process 1, create a branch or pull a remote warehouse other branches created by others
//创建分支并提交到远程仓库 git checkout -b develop/新分支名称 master //创建分支并切换到“develop/新分支名称”分支 git push -u origin develop/新分支名称 //第一次提交需要加-u,这样可以绑定本地和远程分支关系,之后push和pull不用再指定后面“origin develop/新分支名称” //拉取远程仓库别人创建的分支 git fetch origin git branch -a //查看所有分支,包括本地和远程 git checkout -b develop/新分支 origin/develop/新分支 //“origin/develop/新分支”是远程仓库别人创建的分支 |
2, the development of new features merged master, and testing, to go live
//--no-ff会禁用Fast forward模式 git merge --no-ff master |
3, after the end of the line, you need to merge the development branch back to master
//合并到master git checkout master git merge --no-ff develop/xxx |
Four, the use of Skill 1, configure shortcut commands
git config --global alias.st status //git status 简化 git st git config --global alias.co checkout //git checkout 简化 git co git config --global alias.ci commit //git checkout 简化 git ci git config --global alias.br branch //git checkout 简化 git br git config --global alias.lg "log --color --graph --pretty=format:‘%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset‘ --abbrev-commit" |
Server git development process