I try to avoid using aliases in my daily shell usage. I've taught using Git for over a decade now and I don't want to have to translate gup
to git fetch && git rebase
or gcp
to git cherry-pick`. I've got completion installed and use it, but at least this way I'm seeing the commands that are being used so I keep that muscle memory fresh.
That's not to say I don't use any aliases. I constantly trip myself up on new machines because I've come to expect git st
or git di
to be aliased to git status
or git diff
(some Subversion habits die hard). There are a couple that I've recently added that I find myself reaching for multiple times a day.
Everything builds off of git delete-merged
. It's a simple alias that runs this command (full aliases below):
git branch --merged | grep -v '^\*' | xargs git branch -d
This takes the list of all branches, filters out the current branch, then run git branch -d
on the resulting list. On top of that, I also added pad
and fad
aliases that refer to pull or fetch and delete. Couple that with --prune
and I can keep my local Git repository and branches in check.
Here's a gist with all of my aliases:
Hope you found this useful!
Top comments (0)