git branch operation notes

git basic operation common

Only a master remote repository branch, create and upload dev branch

# 创建本地dev分支
git checkout -b dev master

# 推送dev分支到远程仓库
git push origin dev

# 本地dev分支关联远程dev分支
git branch --set-upstream-to=origin/dev dev

# 查看分支信息,如下图显示,都已经关联到各自远程分支
git branch -vv
* dev    93378f9 [origin/dev] Merge branch 'dev'
  master 93378f9 [origin/master] Merge branch 'dev'

After the remote repository has multiple branches, clone codes handover branch dev

git checkout -b dev origin/dev

bugfix branch

# 创建一个bugfix 的临时分支:
  git checkout -b bugfix-0.1 master
# 修正bug后,再合并到master分支和develop分支
  git checkout master
  git merge --no-ff bugfix-0.1
  git checkout develop
  git merge --no-ff bugfix-0.1
# 再然后,删掉这个临时分支
 git branch -d bugfix-0.1

As used herein, the --no-ff parameters, because, Git formula merged fast forward (fast-farward merge) the default, but the master branch pointer to the branch bugfix-0.1, and --no-ff will merge to create a logs, history log to ensure no loss when bugfix-0.1 branch delete

the entire process

Here enclose the entire flow chart, taken from the teacher's blog Ruan Yifeng

Guess you like

Origin www.cnblogs.com/zhenghengbin/p/11594530.html