Skip to content

Instantly share code, notes, and snippets.

@IlanVivanco
Last active November 1, 2021 19:57
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 IlanVivanco/1a94dc6b84a8fb71b6f271973e5a8bda to your computer and use it in GitHub Desktop.
Save IlanVivanco/1a94dc6b84a8fb71b6f271973e5a8bda to your computer and use it in GitHub Desktop.
Util git scripts

Remove dead branches

Removes merged branches that are already deleted from the remote repository, but they are still on your local machine.

git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d

Add this command as git alias

git config --global alias.prune "!git remote update --prune && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment