Skip to content

Instantly share code, notes, and snippets.

@Rafael-Conde
Created November 2, 2022 00:51
Show Gist options
  • Save Rafael-Conde/c66a2909f487fdbda799119eb3f864e4 to your computer and use it in GitHub Desktop.
Save Rafael-Conde/c66a2909f487fdbda799119eb3f864e4 to your computer and use it in GitHub Desktop.

remove local branchs that aren't in the remote anymore

from this incredible answer:

git fetch -p ; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment