Skip to content

Instantly share code, notes, and snippets.

@vincentclaes
Last active November 12, 2025 16:57
Show Gist options
  • Select an option

  • Save vincentclaes/13b807a670a1d115f31a51b2315194dd to your computer and use it in GitHub Desktop.

Select an option

Save vincentclaes/13b807a670a1d115f31a51b2315194dd to your computer and use it in GitHub Desktop.
# remove all local branches except for master
git branch | grep -v "master" | xargs git branch -d
git branch | grep -v "main" | xargs git branch -d
# fetch objects and prune; delete the ones that you cannot reach.
git fetch -pv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment