DEV Community

Discussion on: 10 Git Tricks to Save Your Time and Sanity

Collapse
 
christhekeele profile image
Christopher Keele

Love this, incorporating some of them into my git tricks!

Building on your alias list command, I have an alias called alias:

alias.alias !alias(){ git config --get-regexp "^alias.${1}"; }; alias

This'll list all aliases matching the provided prefix, or just all aliases with no arguments:

git alias
# ... many lines of cool aliases
git alias alias
# alias.alias !alias(){ git config --get-regexp "^alias.${1}"; }; alias
git alias ancestor
# alias.ancestor merge-base --octopus
git alias c
# alias.current rev-parse --abbrev-ref HEAD
# alias.contains !contains(){ git fetch && git rev-parse ${1:-HEAD} | xargs git branch -r --contains; }; contains
# alias.cherrypick cherry-pick