Git 配置

创建
阅读 616
# 设置 email
git config --global user.email "yourname@example.com"

# 设置用户名
git config --global user.name "yourname"

# 设置默认编辑器
git config --global core.editor vi

# 取消文件权限变更记录
git config --local core.filemode false
# cat ~/.gitconfig
[user]
    name = ryanlid
    email = ryanlid@live.com
[core]
    # 配置方法
    # https://www.cnblogs.com/flying_bat/p/3324769.html
    # 禁用中文转义
    quotepath = false
    # 禁用换行符自动转换
    autocrlf = false
    # 拒绝提交包含混合换行符的文件
    safecrlf = true
    # 忽略文件权限修改
    filemode = false
    # 设置默认编辑器
    editor = vi
    ## Linux
    # excludesfile = /home/ryan/.gitignore
    ## Windows
    # excludesfile = C:\\Users\\ryan\\.gitignore
    ## macOS
    # excludesfile = /Users/ryan/.gitignore
[alias]
# 别名配置
    last = log -1
    lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
    lgme = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --author=ryanlid
    s = status
    cm = commit
    f = fetch
    fo = fetch origin
    p = push
    puo = push origin
    puom = push origin main
    pdo = pull origin
    pdom = push origin main
    mm = merge main
    com = checkout main

https://gist.github.com/ryanlid/6794661cd10e72bf7ec24bf48e3604f2

本文链接 https://www.yidiankuaile.com/post/git-config

最后更新