Skip to content

Instantly share code, notes, and snippets.

@jzucker2
Last active August 29, 2015 14:13
Show Gist options
  • Save jzucker2/bed2b5a2dabf691c0d5b to your computer and use it in GitHub Desktop.
Save jzucker2/bed2b5a2dabf691c0d5b to your computer and use it in GitHub Desktop.
My ps1/git completion
[user]
email = jordan.zucker@gmail.com
name = Jordan Zucker
[alias]
cm = commit -m
swap = checkout -
lc = log ORIG_HEAD.. --stat --no-merges
mkbr = checkout -b
sm = submodule update --init --recursive
llog = log --date=local
changes = diff --name-status -r
diffstat = diff --stat -r
new = !sh -c 'git log $1@{1}..$1{0} "$@"'
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
intercommit = !sh -c 'interdiff <(git show $1) <(git show $2) | less -FRS' -
sortdiff = !sh -c 'git diff "$@" | grep "^[+-]" | sort --key=1.2 | uniq -u -s1'
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
co = checkout
br = branch
st = status --short
last = log -1 HEAD
[push]
default = simple
source ~/.git-completion.bash
source ~/.git-prompt.sh
# First suggested way
#PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
# configure git prompt settings
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM="verbose"
GIT_PS1_SHOWCOLORHINTS=true
#second suggested way
PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment