Skip to content

Instantly share code, notes, and snippets.

@alkemann
Last active August 23, 2019 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alkemann/28e516f38815d6e6ab2d to your computer and use it in GitHub Desktop.
Save alkemann/28e516f38815d6e6ab2d to your computer and use it in GitHub Desktop.
Git configs for neat colors and aliases
[color]
ui = auto
diff = auto
status = always
branch = always
interactive = always
[color "branch"]
current = 220
local = 222
remote = 106
plain = magenta
[color "diff"]
plain = 240
meta = 248
frag = 69
old = 203
new = 149
commit = 220
whitespace = normal red
[color "status"]
header = 15
added = 154
updated = 190
changed = 208
untracked = 67
nobranch = 228
[color "decorate"]
current = 220
local = 222
remoteBranch = 106
tag = 107
stash = 149
HEAD = 69
plain = magenta
[color "grep"]
context = 249
filename = 137
function = 69
linenumber = 228
match = 220
selected = 230
separator = 65
[alias]
pul = pull
pr = pull --rebase
git = !exec git
cp = cherry-pick
war = diff --name-only --diff-filter=U
co = checkout
st = status -s -b
d = diff
dc = diff --cached
f = fetch -f -v
unstage = reset HEAD
uncommit = reset --soft HEAD^
amend = commit --amend
b = branch -v -a
gl = log --oneline --decorate --stat --graph
lg = log --decorate --stat --graph --pretty=format:'%C(69)%h%Creset (%ar - %C(220)%an%C(15)), %s%n'
lc = log ORIG_HEAD.. --stat --no-merges
pl = log --abbrev-commit --pretty=oneline
ll = log --pretty=format:'%C(220)%h\t%C(208)%ar\t%C(107)%d %C(252)%s %C(69)%cn'
la = log --pretty=format:'%C(208)%cr\t%C(220)%h\t%C(69)%aN%Creset%C(107)%d %C(252)%s'
rp = log --patch --reverse --pretty=format:'%C(220)%h%Creset (%ar - %C(220)%an%Creset), %s%n' --decorate --stat
subway = log --graph --color --pretty=format:"%C(220)%h%x09%C(107)%d%C(252)%x20%s"
metro = log --graph --all --color --pretty=format:"%C(220)%h%x09%C(107)%d%C(252)%x20%s"
m = log --graph --all --color --pretty=format:"%C(220)%h%x09%C(107)%d%C(252)%x20%s"
sincenext = log --patch -w --reverse origin/next..
prune-all = !git remote | xargs -n 1 git remote prune
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
spush = svn dcommit
spull = svn rebase
serve = daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
meff = merge --no-ff
gr = grep -pn --heading -C2
cm = commit -m
ci = commit
cp = cherry-pick
au = add -u
ap = add -p
recent = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment