6. Git Config

6.1. Config File

6.1.1. Global Config

  • ~/.gitconfig

6.1.2. Local Config

  • .git/config

  • git config multiple url

6.1.3. Configuration

[i18n]
    commitencoding = UTF-8
    logoutputencoding = UTF-8
[core]
    eol = 'lf'
    autocrlf = input
    excludesfile = /Users/matt/.gitignore_global
[branch "master"]
    rebase = true
[branch]
    #autosetuprebase = always
# git config --global color.diff.meta "blue black bold"

[color]
    ui = true
[merge]
  tool = extMerge

[mergetool "extMerge"]
  cmd = extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
  trustExitCode = false
[diff]
  external = extDiff

6.2. Notable

  • receive.fsckObjects

  • receive.denyNonFastForwards

  • receive.denyDeletes

  • core.autocrlf

  • color.branch

  • color.diff

  • color.interactive

  • color.status

  • user.signingkey

  • commit.template

  • core.editor

6.3. Aliases

l = log --pretty=format:"%C(yellow)%h %ad%Cred%d %Creset%s%Cblue [%cn]" --decorate --date=short
again = "!f() { git add -A && git status && git commit -m \"$(git log -1 --format='%s')\" && git push && git l -1; }; f"
d = diff --cached HEAD^
csv = log --pretty=format:'"%h", "%an", "%ae", "%ad", "%s"'

6.4. Gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/