• git 使用


    一、创建新分支

    1. git branch 查看已有的所有分支。

    2. git branch andy 创建名叫andy的分支。

    3. git branch  再看看是不是多了一个叫andy的分支,例如:

      *master

        andy

    4. git checkout andy 切换到andy分支

    5. git push --set-upstream origin andy  将andy分支推送到远程仓库

    6. git checkout master 切换回mster主分支。

    二、删除分支

    1. git push origin --delete andy  把远程的andy分支删除掉

    2. git branch -d andy  同时把本地对应的andy分支删掉 

    三、clone 分支

    git clone 下来的仓库是没有其分支的,怎么办?如下:

    1. git branch -a,列出所有分支名称如下:
      remotes/origin/andy
      remotes/origin/master
    2. git checkout -b andy origin/andy,作用是checkout远程的andy分支,在本地起名为andy分支,并切换到本地的andy分支

    3. git branch 看看就有了。

     四、回退指定版本

    A. 回滚指定文件

    1. git reset e5ca2e9a74634b744b19ed05252ccb49092bff8e ./Elasticsearch.php

    2. git commit -m"reset"

    3. git checkout ./Elasticsearch.php

    4. git push

    完成

    B. 回滚整个项目

    1. git reset --hard e5ca2e9a74634b744b19ed05252ccb49092bff8e

    五、Git 多平台换行符问题(LF or CRLF)

    如果涉及到在多个系统平台上工作,推荐将 git 做如下配置:

    git config --global core.autocrlf input
    git config --global core.safecrlf true

    http://kuanghy.github.io/2017/03/19/git-lf-or-crlf

  • 相关阅读:
    .NET 开源GIS解决方案一 概述
    未能正确加载“Microsoft.VisualStudio.Editor.Implementation.EditorPackage”包
    C# Winform欢迎窗体实现()
    Log4Net使用指南(转)
    DotNet经典面试题(转载)
    这是一篇测试文章
    每天进步一点点
    博客园公告栏添加两个有趣的控件
    eclipse下查看maven下载的源码中文乱码问题
    WEB 基础知识(一)
  • 原文地址:https://www.cnblogs.com/bootoo/p/5131734.html
Copyright © 2020-2023  润新知