-
Notifications
You must be signed in to change notification settings - Fork 0
0823开始进行对git分支的相关操作
ziyouzy edited this page Aug 24, 2020
·
3 revisions
查看本地分支:$ git branch
查看远程分支:$ git branch -r
查看所有分支:$ git branch -a
本地创建新的分支:$ git branch [branch name]
例如:
$ git branch gh-dev
切换到新的分支:$ git checkout [branch name]
例如:
$ git checkout gh-dev
创建+切换分支:$ git checkout -b [branch name]
效果相当于以下两步操作:
$ git branch [branch name]
$ git checkout [branch name]
合并分支: $git merge [branch name]
需要先切换到主分支下
将新分支推送到github:$ git push origin [branch name]
例如:
$ git push origin gh-dev
推主分支:$ git push origin master
推子分支:$ git push origin buildservice
1.先将主分支commit一下
2.创建子分支buildservice
3.先推子分支
4.再推主分支