Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_36209121/article/details/91429217
2. collaborative development branch
The relevant branch, the branch does not have to push the remote, such as branch bug
- Master - the main branch
- Merged with other branches;
- Stable version, at any time on-line;
- Develop - development branch
- And wherein a branch is typically used in conjunction with feature;
- The characteristic feature of all branches base;
- After completion of the new feature wherein the branch test functions, may be incorporated into develop
- bug / Hotfix - bug fix branch / matter of urgency
- master branch code issues arise, this branching process, and then incorporated into the master;
- The master concomitant merger develop branch;
- Generally do not need to upload to the service;
- Release - steady state;
- develop branch developed sufficiently stable state, this development branch, merge to release (the test before the final on-line);
- After the test, and incorporated into the master Develop;
- the Feature - custom needs branch
- Custom development of new features;
- After the development is completed merger to develop;
View branch
# 查看分支
git branch
git branch newBr # 新建newBr的分支, 如果分支已经存在,代码会报错;
-f : 强制覆盖创建分支;
git branche -m oldBranch newBranch # 分支重命名;
git branche -d oneBr twoBr# 删除分支, 不能在当前分支删除当前分支, 没有合并的分支不能删除;
git branche -D oneBr twoBr # 强制删除(未合并)分支;
git branch newBr a12b74f # 回复删除的分支;
Switching branch
# 切换分支
git checkout 分支名称
git checkout -b newBr #新建本地分支, 并切换;
git checkout -b 本地分支 orgin/远程分支 #拉取远程分支到本地分支
Merge branch
# 合并分支 brName 到当前分支
git merge brName
View all branches of the submitted records
# 查看所有分支的提交记录
git reflog
Git learning (01) _ basic commands