Skip to content

Instantly share code, notes, and snippets.

@cboudereau
Last active November 27, 2023 13:31
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 cboudereau/466c7fac511c8cf5fc9455cf2e7c3913 to your computer and use it in GitHub Desktop.
Save cboudereau/466c7fac511c8cf5fc9455cf2e7c3913 to your computer and use it in GitHub Desktop.
git prune except main
#!/bin/bash
# dry run
g remote prune -n origin
# remove old local remote
g remote prune origin
# remove old local branches except main
g br | grep -ve main | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment