Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Last active May 10, 2023 14:39
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benjamincharity/e7d09f90e26a1ec75ae549470f340116 to your computer and use it in GitHub Desktop.
Git alias function to delete local AND remote branch(s). NOTE: If dealing with branches that are not fully merged, the `-d` would need to change to `-D`.
[alias]
deletebranch = "!f() { \
git push origin --delete "$@"; \
git branch -d "$@"; \
}; f"
# usage:
# git deletebranch my-branch
# git deletebranch branch-1 branch-2 branch-3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment