Configuring your Git

Config is layered: system, global (user), local (repo)

# System
cat /etc/gitconfig

# Global (user)
cat ~/.gitconfig # or ~/.git/config

# repo-specific
cat ./.git/config

Set defaults for all your projects in ~/.gitconfig, either by editing the file directly, or by using the config subcommand. E.g.:

# Set a sane editor (otherwise uses value from $EDITOR)
$ git config --global core.editor emacs

# Set a custom commit message template
git config --global commit.template ~/.git-commit-template

Gerard's current ~/.git-commit-template file:

Most interesting is the user's global config

    name = Gerard Ryan
    email =
    signingkey = 8A617903604095DC

    excludesfile = ~/.gitignore
    quotepath = false
    autocrlf = input
    safecrlf = warn
    editor = emacsclient -t -a emacs

    protocol = ssh

    template = /home/grdryn/.git-commit-template
    gpgsign = true

    program = gpg2

Aliases are really useful

    br = branch
    co = checkout
    ci = commit -a
    d = diff --color-words
    st = status
    lol = log --graph --decorate --all --abbrev-commit --pretty=oneline
        lg = log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
    scrub = !git reset --hard && git clean -fd

Lots of other useful aliases and config customization examples here: