Git learning (02) _ branch - collaborative development

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

  1. Master - the main branch
    1. Merged with other branches;
    2. Stable version, at any time on-line;
  2. Develop - development branch
    1. And wherein a branch is typically used in conjunction with feature;
    2. The characteristic feature of all branches base;
    3. After completion of the new feature wherein the branch test functions, may be incorporated into develop
  3. bug / Hotfix - bug fix branch / matter of urgency
    1. master branch code issues arise, this branching process, and then incorporated into the master;
    2. The master concomitant merger develop branch;
    3. Generally do not need to upload to the service;
  4. Release - steady state;
    1. develop branch developed sufficiently stable state, this development branch, merge to release (the test before the final on-line);
    2. After the test, and incorporated into the master Develop;
  5. the Feature - custom needs branch
    1. Custom development of new features;
    2. 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

Git learning (02) _ branch - collaborative development

GGit learning (03) _ Emergency bug branching

Guess you like

Origin blog.csdn.net/qq_36209121/article/details/91429217