在git操作中有很多命令我们自己可以起别名,以提高操作效率。

1. 配置方式

1)项目级别的配置,仅对当前项目生效(将写入到.git/config文件中)
    $ git config --global alias.st status

2)用户级别的配置(使用--global (将写入到~/.gitconfig中)
    $ git config --global alias.st status
    $ git config --global alias.co checkout

3)系统级别的配置(使用--system)对整个系统生效
    $ git config --system  对整个系统生效

2. 常用设置

$ git config --global color.ui auto
$ git config --global user.name "test"
$ git config --global user.email "test@sina.com"
$ git config --global color.ui auto $ git config --global alias.st status
$ git config --global alias.co checkout
$ git config --global alias.ci commit
$ git config --global alias.br branch $ git config --global alias.ps push
$ git config --global alias.pl pull $ git config --global alias.unstage 'reset HEAD' $ git config --global alias.last 'log -1'
$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

3. 其他命令

  查看设置的别名  git config --list | grep alias

  取消别名设置  git config --global --unset alias.st

git 之别名配置的更多相关文章

  1. git取别名配置

    已经配置的别名 $ git config --global alias.st status $ git config --global alias.co checkout $ git config - ...

  2. Git 基础 —— 安装 配置 别名 对象

    Git 基础学习系列 Git 基础 -- 安装 配置 别名 对象 Git 基础 -- 常用命令 Git 基础 -- 常见使用场景 Git基础 -- Github 的使用 Git 安装 Git下载地址 ...

  3. Mac上git的安装配置与使用简述

    Mac下git搭建及使用 之前就只是经常在GitHubs上下载代码,也没注意怎么上传项目.一开始对git都没什么了解花了几个小时去小补了下知识.如果有需要可以转去这里学习:[GIT使用简易指南] (h ...

  4. g4e基础篇#3 Git安装与配置

    g4e 是 Git for Enterprise Developer的简写,这个系列文章会统一使用g4e作为标识,便于大家查看和搜索. 章节目录 前言 1. 基础篇: 为什么要使用版本控制系统 Git ...

  5. git命令别名(Alias)

    每次切换分支: git ckeckout branch_name 等命令费时又费力,git 别名配置起来: 别名配置: git config --global alias.ck ckeckout 其他 ...

  6. 【亲测可用,亦可配置同一平台的不同账号,例如阿里云的两个不同账号】Windows下Git多账号配置,同一电脑多个ssh-key的管理

    Windows下Git多账号配置,同一电脑多个ssh-key的管理   这一篇文章是对上一篇文章<Git-TortoiseGit完整配置流程>的拓展,所以需要对上一篇文章有所了解,当然直接 ...

  7. 第一讲:Git分区,配置与日志

    前言 曾经听到过这样一句话:不会git就不要敲代码了.细细品味确实有其中的道理,可能是当事人代码被强行覆盖后的叹息吧! 因此,为了避免这种情况,接下来我们就一起来好好学习git的相关知识吧!不怕你不会 ...

  8. Win7上Git安装及配置过程

    Win7上Git安装及配置过程 文档名称 Win7上Git安装及配置过程 创建时间 2012/8/20 修改时间 2012/8/20 创建人 Baifx 简介(收获) 1.在win7上安装msysgi ...

  9. Windows系统中Git的安装配置

    一.Git安装 1.下载 Git官网:https://git-scm.com/download/ 选择windows版本下载即可. 百度软件中心:http://rj.baidu.com/ 如官网下载不 ...

随机推荐

  1. UESTC_秋实大哥与花 2015 UESTC Training for Data Structures<Problem B>

    B - 秋实大哥与花 Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submi ...

  2. sql语句收集

    一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备 ...

  3. WIN7 64位系统安装JDK并配置环境变量

    本文来自:http://jingyan.baidu.com/article/3c343ff70bc6ea0d377963df.html 工具/原料 JDK 方法/步骤   首先,下载JDK安装包,到官 ...

  4. AudioManager详解(结合源代码)

    AudioManager:用来对音量大小,声音模式(静音,震动,震动加声音等模式)的管理, 还有用它来注册“插入耳机”时的广播接收者(Action: android.intent.action.MED ...

  5. mysql binlog参数设置

    1.mysql有许多系统变量,可以设置,系统变量设置不同,不同的系统将导致执行状态. 故mysql提供两组命令,分别查看系统设置和执行状态. 1.系统设置: SHOW [GLOBAL | SESSIO ...

  6. 【计算几何初步-线段相交+并查集】【HDU1558】Segment set

    Segment set Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  7. Java使用默认浏览器打开指定URL

    直接贴代码: 方法一: Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://www.baidu.co ...

  8. web前端技术归类

    1.以屏幕可用宽和高的百分比来定义弹出框的宽和高 var trueWidth = $(top.window).width() * 0.9;var trueHeight = $(top.window). ...

  9. gridview获取当前行索引的方法

    在用GridView控件时,我们经常会碰到获取当前行的索引,通过索引进行许多操作.例如,可以获得当前行某一个控件元素:设置某一元素的值等等. 下面结合实例介绍几种获得GridView当前行索引值的方法 ...

  10. 用canvas绘制一个时钟

    实现一个时钟的绘制和时间的显示 一,首先是页面的搭建html部分以及一点点的css代码,因为css这块用的比较少,所以就没有单独出来: <!DOCTYPE html> <html l ...