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

  • 相关阅读:
    Apache 性能配置优化
    大数据企业备份
    Docker限制容器可用的CPU
    docker运行容器后agetty进程cpu占用率100%
    Ubuntu下crontab命令的用法
    set -x与set +x指令
    CentOS设置程序开机自启动的方法
    maven 打JAR包资源文件指定路径与文件读取
    hadoop-maven项目打包成可执行的jar
    如何将maven项目打包成可执行的jar
  • 原文地址:https://www.cnblogs.com/rsky/p/4901694.html
Copyright © 2011-2022 走看看