Skip to content

Instantly share code, notes, and snippets.

@kgn
Forked from henrik/.bashrc
Last active May 9, 2016 20:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgn/760788 to your computer and use it in GitHub Desktop.
Save kgn/760788 to your computer and use it in GitHub Desktop.
My user setup
[alias]
cl = clone --recursive
un = reset --hard
st = status -s
aa = add --all
ci = commit -m
co = checkout
cob = checkout -b
br = branch
rbr = branch -r
rmrb = push --delete origin # delete a remote branch
rp = remote prune origin # cleanup stale remote branch refs
pr = pull --rebase
ms = merge --squash
sub = submodule add
subup = submodule update --init --recursive
subeach = submodule foreach --recursive
dft = difftool
lg = log --graph --format='%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %s \
%C(green)(%cr) %C(bold blue)<%an>%C(reset)' --date=relative
[core]
quotepath = false
[color]
diff = auto
status = auto
branch = auto
alias subl='open -a "Sublime Text"'
# Inspired by: http://henrik.nyh.se/2008/12/git-dirty-prompt
function parse_git_dirty {
[[ $(git status -s 2> /dev/null | sed 's/^ *//;s/ *$//') != '' ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/($(parse_git_dirty)\1)/"
}
# username@machine[dir](master)$ # clean working directory
# username@machine[dir](*master)$ # dirty working directory
export PS1='\u@\h[$(basename "${PWD}")]$(parse_git_branch)\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment