分支

  1. 创建本地分支 local_branch
    git branch local_branch
  2. 创建本地分支local_branch 并切换到该分支
    git checkout -b local_branch
  3. 切换到分支local_branch
    git checkout local_branch
  4. 推送本地分支local_branch到远程分支 remote_branch并建立关联关系
    • 远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch
      git push
    • 远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch
      git push -u origin remote_branch
    • 远程没有有remote_branch分支并,本地已经切换到local_branch
      git push origin local_branch:remote_branch
  5. 删除本地分支local_branch
    git branch -d | -D local_branch
  6. 删除远程分支remote_branch
    git branch -d -r remote_branch
    7.重命名分支
    git branch -m | -M 旧名称 新名称
  7. 查看分支
    git branch -a
  8. 合并分支local_branch
    git merge local_branch
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • git分支使用的坏习惯 最近使用git提交代码发现大家的方式都不一样,自己在使用中也遇到了一些问题,导致代码危险。...
    好奇的小刺猬阅读 1,744评论 0 1
  • 远程仓库 到目前为止,我们已经掌握了如何在Git仓库里对一个文件进行时光穿梭,你再也不用担心文件备份或者丢失的问题...
    归云丶阅读 1,975评论 0 5
  • 1. 分支管理介绍 1)分支即为两台主机,不同地点、不同时间在干不同的事情。然后上传共同主机,就可以得到所有分支的...
    kison_阅读 563评论 0 0
  • 一、为什么要分支管理 分支在实际中有什么用呢?假设你准备开发一个新功能,但是需要两周才能完成,第一周你写了 50%...
    CondorHero阅读 1,646评论 0 1
  • 冲突合并 创建分支feature1分支,在feature1中修改readme文件,然后在分支中添加并提交, $gi...
    奋斗中的Kevin阅读 659评论 0 1