From 9b2ca08ef5dc6488d7ac67d024c57dba4c0d153a Mon Sep 17 00:00:00 2001 From: Rui Maranhao Date: Tue, 28 Feb 2017 11:27:13 +0000 Subject: [PATCH] Added git alias to remove local branches no longer on remote The command `grrb` deletes all local branches which do not have a remote equivalent. --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 34942d38..beff771d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -239,3 +239,5 @@ alias glum='git pull upstream master' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"' + +alias grrb='git fetch -p && for branch in `git branch -vv | grep ': gone]' | gawk '{print $1}'`; do git branch -D $branch; done'