git常用命令

git的一些常用命令

配置

  • 查看

    1
    2
    3
    git config -l 
    git config --global -l #查看全局配置
    git config --local -l #查看本地配置
  • 设置

    1
    2
    3
    4
    git config --global user.name "John Doe" #设置用户名
    git config --global user.email [email protected] #设置用户信箱
    git config --global credential.helper store #设置权限保存,cache保留15分钟
    git config --global core.autocrlf true # true:提交时CRLF->LF,签出时LF->CRLF;input:提交时CRLF->LF,签出时不转换;false:不转换
  • 本地设置(.gitattributes)

    1
    2
    # Set the default behavior, in case people don't have core.autocrlf set.
    *.sh text eol=lf

初始化