Skip to content

Commit

Permalink
git configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
pigoz committed Apr 1, 2012
1 parent c5d7448 commit 03c48de
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
43 changes: 43 additions & 0 deletions gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# vim: syntax=gitconfig

[user]
name = Stefano Pigozzi
email = [email protected]
[color]
branch = auto
diff = auto
interactive = auto
status = auto
[core]
excludesfile = ~/.gitignore
editor = vim
[merge]
tool = opendiff
[mergetool "mvim"]
cmd=/usr/local/bin/mvim -d -g $LOCAL $MERGED $REMOTE
keepbackup=false
[alias]
st = status
ci = commit
co = checkout
di = diff
dc = diff --cached
amend = commit --amend
aa = add --all
head = !git l -1
h = !git head
r = !git l -20
ra = !git r --all
ff = merge --ff-only
pullff = pull --ff-only
noff = merge --no-ff
l = "!source ~/.githelpers && pretty_git_log"
la = !git l --all
div = divergence
gn = goodness
gnc = goodness --cached
fa = fetch --all
pom = push origin master
b = branch
ds = diff --stat=160,120
dh1 = diff HEAD~1
35 changes: 35 additions & 0 deletions githelpers
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# vim: syntax=sh

# Log output:
#
# * 51c333e (12 days) <Gary Bernhardt> add vim-eunuch
#
# The time massaging regexes start with ^[^<]* because that ensures that they
# only operate before the first "<". That "<" will be the beginning of the
# author name, ensuring that we don't destroy anything in the commit message
# that looks like time.
#
# The log format uses } characters between each field, and `column` is later
# used to split on them. A } in the commit subject or any other field will
# break this.

HASH="%C(yellow)%h%Creset"
RELATIVE_TIME="%Cgreen(%ar)%Creset"
AUTHOR="%C(bold blue)<%an>%Creset"
REFS="%C(red)%d%Creset"
SUBJECT="%s"

FORMAT="$HASH}$RELATIVE_TIME}$AUTHOR}$REFS $SUBJECT"

pretty_git_log() {
git log --graph --abbrev-commit --date=relative --pretty="tformat:${FORMAT}" $* |
# Repalce (2 years ago) with (2 years)
sed -Ee 's/(^[^<]*) ago)/\1)/' |
# Replace (2 years, 5 months) with (2 years)
sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?)/\1)/' |
# Line columns up based on } delimiter
column -s '}' -t |
# Page only if we need to
less -FXRS
}

0 comments on commit 03c48de

Please sign in to comment.