How to Delete a Git Branch Locally and Remotely
Suppose we want to delete branch
my_branch from the
Delete local branch
git branch -d my_branch
-D will force delete while
-d will provide a warning if the changes aren’t merged in.
Delete remote branch
git push origin -d my_branch
Update other machines
After deleting the remote branches, we’ll want to update other machines that may still have this branch.
git fetch --all --prune
This will remove any “obsolete remote-tracking branches”.
To check these branches, we can run:
git branch -a