Skip to content

Instantly share code, notes, and snippets.

@trobrock
Created April 11, 2012 17:33
Show Gist options
  • Save trobrock/2360761 to your computer and use it in GitHub Desktop.
Save trobrock/2360761 to your computer and use it in GitHub Desktop.
function gbd() {
if [[ -n $1 ]]; then
if [[ -n $2 ]]; then
git push $1 :$2
git branch -d $2
else
git push origin :$1
git branch -d $1
fi
fi
}
compdef _git gbd=git-branch
function git_diff_count() {
foreach b (`git branch | grep -v '*' | grep -v 'master'`); echo $b `git cherry -v master $b | wc -l`; end
}
function git_diff_clean() {
foreach b (`git_diff_count | awk '/([a-zA-Z0-9]+) 0/{print $1}'`); gbd trobrock $b; end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment