Created
October 5, 2017 14:31
-
-
Save saintsGrad15/eee2a70c214e08c55697d61659bbdbd4 to your computer and use it in GitHub Desktop.
A function to delete a branch from git both locally and on the remote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteBranch() | |
{ | |
git branch -d "$1" | |
if [ $? -ne 0 ]; then | |
echo "Trying with -D" | |
git branch -D "$1" | |
fi | |
if [ $? -ne 0 ]; then | |
echo "Cannot delete branch" | |
else | |
git push origin ":$1" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment