Skip to content

Instantly share code, notes, and snippets.

@kminiatures
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kminiatures/5d21bcc2ab3899a0629a to your computer and use it in GitHub Desktop.
Save kminiatures/5d21bcc2ab3899a0629a to your computer and use it in GitHub Desktop.
merged_branch for bash_completion
# bash_completion
merged_branch () {
local branches
local input=$2
branches=`git b --no-color --merged | grep -v master`
# echo $branches
COMPREPLY=($(compgen -W '$branches' -- $input))
}
# Delete Remote(pub) and Local Branch.
delete_pub_and_local_branch () {
local branch=$1
git push pub :$branch;
git b -d $branch;
}
# Add Completion to Command
complete -F merged_branch delete_pub_and_local_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment