Skip to content

Instantly share code, notes, and snippets.

@meysampg
Created February 21, 2022 10:42
Show Gist options
  • Save meysampg/e016f0be5a069522d9555f19a19bb46b to your computer and use it in GitHub Desktop.
Save meysampg/e016f0be5a069522d9555f19a19bb46b to your computer and use it in GitHub Desktop.
Cleanup Git Repository
# git config --global --edit
[alias]
cleanup = "!git branch --merged master | grep -v '\\*\\|master\\|main\\|develop' | xargs -n 1 -r git branch -d"
cleanup-remote = "!git branch --remote --merged master | grep -v '\\*\\|master\\|main\\|develop' | xargs -n 1 -r git branch -r -d"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment