Skip to content

Instantly share code, notes, and snippets.

@evgeny-goldin
Created October 9, 2012 21:21
Show Gist options
  • Save evgeny-goldin/3861542 to your computer and use it in GitHub Desktop.
Save evgeny-goldin/3861542 to your computer and use it in GitHub Desktop.
Git aliases
alias grw='clear && ./gradlew -S $*'
alias pack='tar -czf'
alias gc='git checkout $*'
alias gs='git status'
alias gw='git whatchanged $*'
alias gl='git log --format=format:[%h]-[%cn]-[%cr]-[%s] -10 $*'
# Git backup
alias gitb='gitgc && rm -f ~/Dropbox/Backup/projects/${PWD##*/}.tar.gz && pack ~/Dropbox/Backup/projects/${PWD##*/}.tar.gz -X ~/git-backup-exclude.txt .'
alias gitbg='grw clean && gitb'
alias gitbm='mvn clean && gitb'
# Git GC
function gitgc() {
rm -rf .git/hooks
git stash clear
git reflog expire --expire=1.minute refs/heads/master
git fsck --unreachable --strict
git prune -v
git gc
}
# Enhanced "git log"
function gll() {
cls
git --no-pager log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -10 $1
echo
}
# "git fetch" + enhanced "git log"
function ggll() {
cls
git fetch
gll
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment