Skip to content

Instantly share code, notes, and snippets.

@rostreim
Last active March 27, 2020 18:19
Show Gist options
  • Save rostreim/bbcb5fb1c582810a49099f1b08f61ab8 to your computer and use it in GitHub Desktop.
Save rostreim/bbcb5fb1c582810a49099f1b08f61ab8 to your computer and use it in GitHub Desktop.
gitconfig aliases I frequently use
[alias]
# lga = log --graph --oneline --all --decorate
# lg = log --graph --all --pretty=format:'%C(bold)%h%Creset -%C(auto)%d%Creset %s %C(green dim)(%cr)%Creset %C(ul)<%an>'
# log adog
lga = log --all --decorate --oneline --graph
# excluded for now (commit subjects only) lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(green)%h%C(reset)%C(auto)%d%C(reset) %C(cyan)<%an>%C(reset) %C(green dim)(%ar)%C(reset)%n %C(white)%s%C(reset)%n' --all
# log adog but with time, author, and full commit body
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(green)%h%C(reset)%C(auto)%d%C(reset) %C(cyan)<%an>%C(reset) %C(green dim)(%ar)%C(reset)%n %C(white)%s%C(reset)%n%C(dim white)%b%C(reset)' --all
# deprecated: lgd = log --graph --abbrev-commit --decorate --format=format:'%C(green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
# remove merged branches (excluding master, qa, and dev)
cleanup = "!git branch --merged | grep -v '\\*\\|master\\|qa\\|dev' | xargs -n 1 git branch -d"
# do an interactive rebase with the given number of commits
rbi = "!git rebase -i HEAD~\"$1\" #"
# add all files and commit
ca = "!git add -A . && git commit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment