benjamincharity
8/8/2017 - 2:46 PM

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 ch

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