git切换分支,合并分支

切换分支

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值