How do I delete a Git branch locally and remotely?
Steps for deleting a branch:
For deleting the remote branch:
git push origin --delete <your_branch>
For deleting the local branch, you have three ways:
1: git branch -D <branch_name> 2: git branch --delete --force <branch_name> //same as -D 3: git branch --delete <branch_name> //error on unmerge
Explain: OK, just explain what's going on here!
git push origin --delete to delete your remote branch ONLY, add the name of the branch at the end and this will delete and push it to remote at the same time...
git branch -D, which simply delete the local branch ONLY!...
-D stands for
--delete --force which will delete the branch even it's not merged(force delete), but you can also use
-d which stands for
--delete which throw an error respective of the branch merge status...