Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Last active June 17, 2021 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 rogeruiz/00a8cbed45390d778fd2e0eaccc70ae6 to your computer and use it in GitHub Desktop.
Save rogeruiz/00a8cbed45390d778fd2e0eaccc70ae6 to your computer and use it in GitHub Desktop.
Clean remote branches and local merged branches from a git repository.
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
@rogeruiz
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment