TOC

Git 配置的建议

看了 《How Core Git Developers Configure Git》,作者建议配置应该尽可能简单一些,不要使用 alias 定义别名。

最后作者也提供了一些他建议配置的条目,我在这个基础上做了一点调整(想要原版去上面的链接里面找),如下:

# clearly makes git better

[column]
    # 自动分栏(比如列出分支的时候,会按照屏幕宽度自动分栏显示)
    ui = auto
[branch]
    # 按照最新提交时间排序
    sort = -committerdate
[tag]
    # 默认按字母排序不是好的选择,比如:
    # v0.1
    # v0.10
    # v0.2
    sort = version:refname
[init]
    defaultBranch = master
[diff]
    algorithm = histogram
    colorMoved = plain
    mnemonicPrefix = true
    renames = true
[push]
    default = simple
    autoSetupRemote = true
    followTags = true
[fetch]
    prune = true
    pruneTags = true
    all = true

# why the hell not?

[help]
    autocorrect = prompt
[commit]
    verbose = true
[rerere]
    enabled = true
    autoupdate = true
[core]
    excludesfile = ~/.gitignore
[rebase]
    autoSquash = true
    autoStash = true
    updateRefs = true

# a matter of taste (uncomment if you dare)

[core]
    # fsmonitor = true
    # untrackedCache = true
[merge]
    # (just 'diff3' if git version < 2.3)
    # conflictstyle = zdiff3
[pull]
    # rebase = true
如果你有魔法,你可以看到一个评论框~