Skip to content

Instantly share code, notes, and snippets.

@equinusocio
Created March 29, 2019 11:57
Show Gist options
  • Save equinusocio/94d7bb0809228d6c0a3d5ed6a76b1ea2 to your computer and use it in GitHub Desktop.
Save equinusocio/94d7bb0809228d6c0a3d5ed6a76b1ea2 to your computer and use it in GitHub Desktop.
My global git config and aliases
[user]
name = Mattia Astorino
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color "status"]
added = green
changed = blue
untracked = red
[color "diff"]
meta = yellow
old = red
new = green
[log]
# Better date formats in logs
date = rfc
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
# James Brown version control!
up = push
down = pull
# Sneak changes into your previous commit
sneak = commit -a --amend --no-edit
# Undo the last commit, but preserve the staging area
undo = reset --soft HEAD^
# It’s nice to be nice
praise = blame
who = blame
# Set upstream tracking much faster
publish = "! git push -u origin $(git rev-parse --abbrev-ref HEAD)"
# Show number of commits from all authors.
stats = shortlog -sn --all --no-merges
# Show detailed logs
graph = log --graph --decorate --stat --date=iso --all
# See everything everyone has done recently
overview = log --oneline --no-merges
# See everything I have done recently
recap = log --oneline --no-merges --author=astorino.mattia@gmail.com
# Show very last commit
last = log --oneline -1
# See today’s work
today = log --since=\"00:00:00\" --all --no-merges --oneline --author=astorino.mattia@gmail.com
# Empty line between results from different files.
find = "!git grep --break -C1"
# Show your ten most recently checked out branches
recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"
# Compare commits in one branch against another, e.g. $ git compare tkt-0021 to develop
compare = "!f() { git log --oneline $1..$2; }; f"
# See which commits are on your local branch that aren’t on the remote
local = "! git log --oneline --no-merges origin/$(git rev-parse --abbrev-ref HEAD).."
# See which commits are on the remote that aren’t on your local branch
upstream = "! git fetch && git log --oneline --no-merges ..origin/$(git rev-parse --abbrev-ref HEAD)"
# Nicer diffs for prose
wdiff = diff --word-diff
# Make it possible to diff minified code (eww…)
mindiff = diff -w --word-diff-regex=. --color-words -U0
[push]
default = current
[github]
user = equinusocio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment