
Delete All Local Git Branches Except for master or main
Clean up local Git branches safely with commands that keep main or master, explain ‑d versus ‑D, and avoid accidental remote branch mistakes in busy repos.
Articles
Git (Global Information Tracker) is a version control system designed to handle projects with speed and efficiency. It allows you to track changes in source code during software development, and enables large teams to all work on the same codebase whilst reducing the risk of one developer overwriting another. I honestly don't know how we even did team‑based development projects before Git came along!
Below you will find a subset of articles from my blog specifically about Git. This is a topic I have worked with for many years, although it has not been one I have written about often. There are four articles collected here so far, which you can see and read below.

master or mainClean up local Git branches safely with commands that keep main or master, explain ‑d versus ‑D, and avoid accidental remote branch mistakes in busy repos.

Amend Git commits safely with git commit ‑‑amend, message fixes, forgotten files, reset alternatives, tidy history, and remote‑branch cautions cleanly.
Rename local and remote Git branches cleanly, including branch switching, pushing the new name, deleting the old remote, and avoiding typo fallout.

Git is version control, but it also gives you a running record of how work evolved. This article uses that diary analogy to make Git less abstract.