Summary of commands
Delete remote branch - $ git push -d <branch_name>
Delete local branch - $ git branch -d <branch_name>
Note
- that in most cases the remote name is origin.
- -d is the alias name of --delete (with double '-')
Delete Local Branch
To delete the local branch use one of the following:
$ git branch -d branch_name
$ git branch -D branch_name
Note:
- First command deletes the branch if it has already been fully merged in its upstream branch.
- Second option, i.e. command with -D, is an alias for --delete --force, which
deletes the branch "irrespective of its merged status."
Delete Remote Branch
$ git push <remote_name> -d <branch_name>
$ git push <remote_name> :<branch_name>
Example -
git push origin -d bugfix/make-ui-changes
git push origin :bugfix/make-ui-changes