Skip to content

Instantly share code, notes, and snippets.

@usefulthink
Created January 27, 2012 10:51
Show Gist options
  • Save usefulthink/1688258 to your computer and use it in GitHub Desktop.
Save usefulthink/1688258 to your computer and use it in GitHub Desktop.
dotfile-snippets - some pretty useful things to have in your dotfiles
# compute the current git branch, if any
ps1_git_extra() {
local branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ -z "$branch" ] ; then return ; fi
echo -n "[$branch]"
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[33m\]$(ps1_git_extra)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
[alias]
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
sdiff = diff --staged
st = status
stat = status
@line-o
Copy link

line-o commented Jan 30, 2012

noch ein paar .gitconfig standards:
br = branch
ci = commit
co = checkout

@usefulthink
Copy link
Author

hmmm... ci ist üblicherweise ein shortcut für commit -a, aber davon halte ich nicht soviel. Es gibt ja tab-completion, daher braucht man die ja gar nicht soo dringend.

@line-o
Copy link

line-o commented Feb 2, 2012

den hist alias find ich spitze

@usefulthink
Copy link
Author

ne ebenfalls nette alternative ist

git log --oneline --decorate --graph --all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment