Cheatsheet Pages / Git Cheatsheet

How to delete a Git branch locally and on the remote

A feature is merged and its branches are cluttering your local and remote lists.

git branch -d feature/login          # safe delete (fails if unmerged)
git branch -D feature/login          # ⚠️ force delete, even if unmerged
git push -d origin feature/login     # delete the branch on the remote too

Good to know

-d refuses if unmerged (safe); -D forces. Remote delete needs a push.

Git Cheatsheet one-page card — 30 daily and rescue commands
The full one-page card — Git Cheatsheet. Get the complete cheatsheet on GitHub