git分支管理

时间:2022-05-11
本文章向大家介绍git分支管理,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

分支管理

查看分支
# git branch
  alex
* master
创建分支
# git branch test
# git branch
  alex
* master
  test
切换分支
# git checkout alex
Switched to branch 'alex'
分支合并
# git merge alex
Updating 1e0b362..22031de
Fast-forward
 1.txt |    1 +
 3.txt |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100644 3.txt
具体步骤
 vim 1.txt 
# git add 1.txt
# git commit -m "alex fenzhi"
[alex 22031de] alex fenzhi
 1 files changed, 1 insertions(+), 0 deletions(-)
# git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 4 commits.
# git merge alex
Updating 1e0b362..22031de
Fast-forward
 1.txt |    1 +
 3.txt |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100644 3.txt
 删除分支
 # git branch -d test
Deleted branch test (was 1e0b362).