Skip to content

Instantly share code, notes, and snippets.

@mmehta-10
Created August 15, 2023 07:10
Show Gist options
  • Save mmehta-10/20d43366c0fcc3ebcb70527d9d02894a to your computer and use it in GitHub Desktop.
Save mmehta-10/20d43366c0fcc3ebcb70527d9d02894a to your computer and use it in GitHub Desktop.
.gitconfig
# Use alias to fetch from remote and delete any untracked local branches
[alias]
nuke = "!f() { git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == \"[gone]\" {sub(\"refs/heads/\", \"\", $1); print $1}'); do git branch -D $branch; done }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment