How to delete a Git branch locally and remotely
Deleting a branch is two separate steps: remove your local copy, then remove the copy on the remote server (usually origin).
Delete a local branch
git branch -d feature/login
-d only deletes the branch if it is fully merged. To delete it anyway, use -D (short for --delete --force).
git branch -D feature/login
You cannot delete the branch you are currently on. Switch first with git switch main.
Delete a remote branch
git push origin --delete feature/login
This tells the remote to remove that branch. Other people keep their local copies until they delete them.
Clean up stale remote-tracking branches
git fetch --prune
This removes local remote-tracking references (such as origin/feature/login) for branches that no longer exist on the remote.