zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    Markdown文档示例
    Python网络编程(一)
    JS之客户端检测
    MySQL 多表查询
    MySQL 单表查询
    MySQL 入门
    Python内置方法大全
    010 盒模型
    009 CSS选择器
    008 常用样式
  • 原文地址:https://www.cnblogs.com/haibiscuit/p/11986407.html
Copyright © 2011-2022 走看看