I want to delete a branch both locally and remotely.
$ git branch -d
To delete locally - (normal)
git branch -d my_branch
If your branch is in a rebasing/merging progress and that was not done properly, it means you will get an error, Rebase/Merge in progress
, so in that case, you won't be able to delete your branch.
So either you need to solve the rebasing/merging. Otherwise, you can do force delete by using,
git branch -D my_branch
To delete in remote:
git push --delete origin my_branch
You can do the same using:
git push origin :my_branch # Easy to remember both will do the same.
Graphical representation: