笔名:  haibiscuit

博客园: https://www.cnblogs.com/haibiscuit/

Git地址: https://github.com/haibiscuit?tab=repositories  (欢迎star)

本项目地址: https://github.com/haibiscuit/StudyBook

尊重笔者的劳动成果,未经允许请不要转载

五:分支操作

创建分支

(1) 场景一 本地和远程分支都存在(关联分支)

git branch --set-upstream-to=origin/dev dev

(2) 场景二 本地分支dev存在,但远程分支不存在

git push --set-upstream origin dev   //远程创建dev分支并与本地建立关联

(3) 场景三 远程分支存在,需要新建对应的本地分支

git checkout --track origin/dev

其他分支操作

(1) 查看本地仓库和远程仓库的关系

git branch -vv

(2) 列出本地和远程分支

git branch -a

(3) 查看远程分支

git branch -v

(4) 创建并切换到本地分支

git checkout -b <branch-name>

(5) 从远程分支中创建并切换到本地分支

git checkout -b <branch-name> origin/<branch-name>

(6) 删除本地分支

git branch -d <local-branchname>

(7) 删除远程分支

git push origin --delete <remote-branchname>

或者

git push origin :<remote-branchname>

(8) 重命名本地分支

git branch -m <new-branch-name>

Git实战指南----跟着haibiscuit学Git(第六篇)的更多相关文章

  1. Git实战指南----跟着haibiscuit学Git(第五篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  2. Git实战指南----跟着haibiscuit学Git(第十一篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  3. Git实战指南----跟着haibiscuit学Git(第九篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  4. Git实战指南----跟着haibiscuit学Git(第一篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  5. Git实战指南----跟着haibiscuit学Git(第二篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  6. Git实战指南----跟着haibiscuit学Git(第十篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  7. Git实战指南----跟着haibiscuit学Git(第八篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  8. Git实战指南----跟着haibiscuit学Git(第七篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

  9. Git实战指南----跟着haibiscuit学Git(第四篇)

    笔名:  haibiscuit 博客园: https://www.cnblogs.com/haibiscuit/ Git地址: https://github.com/haibiscuit?tab=re ...

随机推荐

  1. 创建raid5(3个raid2个备份)

    创建raid5(3个raid2个备份) 1.首先创建五个磁盘 2.创建RAID5并设置2块备份故障盘: 3.可查看下阵列的详细信息(Spare Devices数量为1): 4.将磁盘阵列格式化为ext ...

  2. luogu P2272 [ZJOI2007]最大半连通子图

    题目描述 一个有向图G=(V,E)称为半连通的(Semi-Connected),如果满足:?u,v∈V,满足u→v或v→u,即对于图中任意两点u,v,存在一条u到v的有向路径或者从v到u的有向路径.若 ...

  3. git 使用详解(5)—— get log 查看提交历史

    git log 查看 提交历史 在提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,可以使用 git log 命令查看. 接下来的例子会用我专门用于演示的 simplegit 项目,运行下面 ...

  4. 过滤器和监听器实现用户的在线登录人数,以及设置session时长。

    过滤器: package com.bjsxt.filter; import java.io.IOException; import javax.servlet.Filter; import javax ...

  5. 【原创】(十三)Linux内存管理之vma/malloc/mmap

    背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: Kernel版本: ...

  6. dockerfile 最佳实践及示例

    Dockerfile 最佳实践已经出现在官方文档中,地址在 Best practices for writing Dockerfiles.如果再写一份最佳实践,倒有点关公门前耍大刀之意.因此本篇文章是 ...

  7. 2019CCPC秦皇岛D题 Decimal

    Decimal Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total S ...

  8. Oracle:row_number()、rank()、dense_rank()

    语法:ROW_NUMBER()  OVER(): row_number的用途非常广泛,排序最好用它,它会为查询出来的每一行记录生成一个序号,依次排序且不会重复,注意使用row_number函数时必须要 ...

  9. ARTS-S linux查看进程打开的文件数

    当怀疑进程打开文件没有关闭时,可以反复执行以下命令,查看进程打开的文件数是否会不断增加. ls -l /proc/18707/fd | wc -l 其中18707是进程id

  10. 深入理解 Java 方法

    方法(有的人喜欢叫函数)是一段可重用的代码段.