Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save browol/bd01e5da06b0047b9a149c9dbe17f365 to your computer and use it in GitHub Desktop.

Select an option

Save browol/bd01e5da06b0047b9a149c9dbe17f365 to your computer and use it in GitHub Desktop.
How to remove local Git branches that do not exist on the remote server?

How to remove local Git branches that do not exist on the remote server?

git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment