zoukankan      html  css  js  c++  java
  • git 之别名配置

      在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

  • 相关阅读:
    《需求工程——软件建模与分析》阅读笔记03
    第十一周周五
    统计字符串里每个词语的数目
    第十一周周四计划
    for循环创建的a标签,当点击时如何确定点击的是哪一个标签?
    第十周计划周二&周三计划
    第十周周二汇报
    第九周周五小思路
    第九周周五计划&&周四总结
    第九周周四计划&&周三总结
  • 原文地址:https://www.cnblogs.com/rsky/p/4901694.html
Copyright © 2011-2022 走看看