Last active
June 17, 2021 14:17
-
-
Save rogeruiz/00a8cbed45390d778fd2e0eaccc70ae6 to your computer and use it in GitHub Desktop.
Clean remote branches and local merged branches from a git repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
limpiaGit() { | |
command git rev-parse --is-inside-work-tree &>/dev/null | |
if [[ $? == 0 ]] | |
then | |
git remote prune origin | |
git branch --merged | rg -v "(^\*|ma[inster]+)" | xargs git branch -d | |
fi | |
} | |
alias limpia-git=limpiaGit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by https://nickymeuleman.netlify.app/blog/delete-git-branches