add new bash function to prune git branches

This commit is contained in:
jc 2023-09-11 16:45:33 -04:00
commit 37e8e7b754
No known key found for this signature in database

View file

@ -78,6 +78,12 @@ parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
} }
# delete local branches that don't exists in remote repository
git-prune() {
git fetch --prune
git branch -vv | grep '\[origin/.*: gone\]' | awk '{print $1}' | xargs git branch -d
}
# Set prompt # Set prompt
color_prompt=yes color_prompt=yes