Skip to content

Instantly share code, notes, and snippets.

@morrizon
Last active January 25, 2017 16:29
Show Gist options
  • Save morrizon/5f5d2b71f773d8e5ae02d7acb96ec0d3 to your computer and use it in GitHub Desktop.
Save morrizon/5f5d2b71f773d8e5ae02d7acb96ec0d3 to your computer and use it in GitHub Desktop.
Default git config

Template of .gitconfig with some aliases

[user]
    name = John Doe
    email = nomail@example.com
  
[color]
    diff = auto
    status = auto
    branch = auto
    interactive = auto
    ui = true
    pager = true

[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green

[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold

[color "status"]
    added = yellow
    changed = green
    untracked = cyan

[core]
    pager = less -FRSX
    whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
    editor = vim

[alias]
    co = checkout
    ci = commit
    st = status
    lol = log --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all
    tags = !sh -c 'git tag -l | sort -V | xargs -n 1 -I tag git log --color --pretty=format:\"%Cred%h%Creset - %C(yellow)tag%Creset %<(100,trunc)%s  %Cgreen(%cr) %C(bold blue)<%an> %Creset\" -1 tag'
        zip = "!f() { git archive --format zip HEAD $(git diff --diff-filter=ACM RTUXB --name-only "$1"..HEAD); }; f" > ../changes_since_$1.zip
        # change head to other branch without modify files
        set-head = git symbolic-ref HEAD refs/heads/$1
        tag-remove = "!f() { test -n \"$1\" && git push origin :refs/tags/$1; }; f"



[push]
    default = simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment