Git checkout -b 分支名 创建和切换一起执行
Git branch 分支名
5.2、分支切换
Git checkout 分支名
5.3、分支合并
git merge 分支1 将分支1合并到当前分支上
5.4、快照分支合并步骤:
1、git checkout -b dev
2、添加 hello5.txt文件
3、git add hello5.txt
4、git commit -m “修改注释”
5、git checkout master 切回到主分支
6、git merge dev
7、git branch -d dev 删除dev分支
8、git branch -v 查看分支情况
W@thinksite MINGW64 /d/thinksitegit (master)
$ git branch -d dev
Deleted branch dev (was 67b4e2c).
W@thinksite MINGW64 /d/thinksitegit (master)
$ git branch -d test
Deleted branch test (was 67b4e2c).
W@thinksite MINGW64 /d/thinksitegit (master)
$ git branch -d rm
Deleted branch rm (was 67b4e2c).
W@thinksite MINGW64 /d/thinksitegit (master)
$ git branch
* master
W@thinksite MINGW64 /d/thinksitegit (master)
$ git checkout -b dev
Switched to a new branch 'dev'
W@thinksite MINGW64 /d/thinksitegit (dev)
$ git add hello3.txt
W@thinksite MINGW64 /d/thinksitegit (dev)
$ git commit -m "add hello3.txt"
[dev ded6489] add hello3.txt
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello3.txt
W@thinksite MINGW64 /d/thinksitegit (dev)
$ git checkout master
Switched to branch 'master'
W@thinksite MINGW64 /d/thinksitegit (master)
$ git merge dev
Updating 67b4e2c..ded6489
Fast-forward
hello3.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello3.txt
W@thinksite MINGW64 /d/thinksitegit (master)
$ git branch -v
dev ded6489 add hello3.txt
* master ded6489 add hello3.txt
以上就是git分支的合并,创建等操作,但是在现实中使用分支快速合并的缺很少,大家一般使用的都是git分支的普通合并。