• Git实战指南----跟着haibiscuit学Git(第六篇)


    笔名:  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>

  • 相关阅读:
    常用数据类型占用内存大小
    A2W,W2A等的使用
    Java 注释规范
    windows WTL使用命令行参数
    C++ for循环与迭代器
    C++11 正则表达式简单运用
    LINUX部署SVN服务器
    LINUX搭建PySpider爬虫服务
    Linux常用操作指令
    Centos搭建Seafile个人网盘
  • 原文地址:https://www.cnblogs.com/haibiscuit/p/11986407.html
Copyright © 2020-2023  润新知