切换分支
git checkout +分支名(分支名不加remove/origin)
如果切换成功,会提示分支切换后的分支;如果提示出现 "分离自哪个分支" 有问题
使用git status 也可以查看当前分支
git checkout +分支名 和 git checkout -b +分支名 的区别
$ git checkout和$ git checkout -b的区别是什么
$ git checkout 切换到某分支;例如 $ git checkout master 切换到主分支
$git checkout -b 新建并切换到新建的分支上;例如 $git checkout -b newbranch
合并分支
https://www.jianshu.com/p/26d050497abb
删除分支
创建分支
查询分支
查看当前应用的分支等信息
git status .
git log .
切换到非master时,在当前分支上,可以直接提交代码
git push origin
提交完了,可以通过网页查看是否提交成功
案例:
[rothwell@localhost IA-V2-MCU]$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/IA-WA100C
remotes/origin/IA-WA100G-MCU-L083
remotes/origin/IA-WA100GC-MCU
remotes/origin/IA-WA100MW-MCU-V2
remotes/origin/IA-WA200C
remotes/origin/IA-WA200C-RS485
remotes/origin/IA-WA200G-MCU-L083_V2
remotes/origin/IA-WA200G-MCU-L083_V2_RS485
remotes/origin/IA-WA300C
remotes/origin/gctlv2
remotes/origin/master
[rothwell@localhost IA-V2-MCU]$
[rothwell@localhost IA-V2-MCU]$ git checkout gctlv2
分支 gctlv2 设置为跟踪来自 origin 的远程分支 gctlv2。
切换到一个新分支 'gctlv2'
[rothwell@localhost IA-V2-MCU]$ git branch -a
* gctlv2
master
remotes/origin/HEAD -> origin/master
remotes/origin/IA-WA100C
remotes/origin/IA-WA100G-MCU-L083
remotes/origin/IA-WA100GC-MCU
remotes/origin/IA-WA100MW-MCU-V2
remotes/origin/IA-WA200C
remotes/origin/IA-WA200C-RS485
remotes/origin/IA-WA200G-MCU-L083_V2
remotes/origin/IA-WA200G-MCU-L083_V2_RS485
remotes/origin/IA-WA300C
remotes/origin/gctlv2
remotes/origin/master