Free tools Windows power users keep installed
One-click scans. No signup required.
To delete a local branch named master safely, switch to another branch and use Git’s merge-checked deletion: git switch main, then git branch -d master. Replace main with the branch you intend to keep. A remote branch and your local origin/master tracking reference are separate: deleting one does not automatically delete the others.
Before deleting master: identify what you mean
Git has distinct refs for a local branch, a branch stored on a remote such as origin, and a local remote-tracking reference such as origin/master. Choose the action that matches your goal:
- Local branch: remove
masterfrom this clone withgit branch -d master. - Remote branch: ask the remote to delete its
masterref withgit push origin --delete master. - Remote-tracking ref: update or prune your local record of remote branches with
git fetch --prune origin.
Before removing an important branch, record its tip commit so you can identify it later: git rev-parse master for the local branch, or git rev-parse origin/master for the tracking ref. Git’s branch documentation explains local branch deletion; the push documentation covers remote deletion.
Safely delete the local master branch
- Check the current branch with
git branch --show-current. You cannot delete the branch currently checked out in this worktree. - Switch to the branch you intend to keep, for example
git switch main. Use its actual name if it is notmain. - Run
git branch -d master.
The lowercase -d is the safe default. Git refuses deletion unless master is fully merged into its configured upstream, or into HEAD if it has no upstream. That check is a safeguard, not a guarantee that every commit you care about has been preserved in the place you expect.
Recommended Free Tools
#1 Best Overall
If Git says the branch is not fully merged
Do not immediately force-delete it. Compare it with the branch you intend to keep: git log main..master. Replace main with the appropriate comparison branch. This shows commits reachable from master that are not reachable from that branch. Inspect the commits and decide whether to merge or otherwise preserve them. Only discard them if that is intentional.
When you have confirmed that losing the branch reference is intended, force deletion is git branch -D master. Uppercase -D bypasses the merged-status safeguard. Git’s branch manual also notes that a branch checked out in another linked worktree cannot be force-deleted; check your worktrees if Git reports that condition.
Rank #2
Delete master from a remote
First confirm which remote and branch you mean, especially if the repository has more than one remote. You can inspect remote names and URLs with git remote -v. To request deletion of the master branch from origin, run:
git push origin --delete master
This deletes the server-side ref if the remote accepts the request. Remote configuration or hooks can reject it, and a hosting service may enforce default-branch or branch-protection rules. Check the repository’s settings on the host if deletion is refused; a Git command cannot override those policies. See Git’s push documentation.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clean up the local origin/master tracking ref
Removing the remote branch does not necessarily remove the stale origin/master reference from every clone. To fetch updates and prune stale remote-tracking refs for origin, run:
git fetch --prune origin
To preview stale references before pruning, use git remote prune --dry-run origin. Review the output before proceeding. Pruning follows remote configuration and refspecs, so take care with unusual refspecs or tag configuration. Git documents pruning and dry-run behavior in its remote documentation.
What can be recovered after deletion?
Deleting a branch removes its ref, and branch deletion also removes that branch’s reflog according to the branch documentation. A commit may still be recoverable if another ref or retained object points to it, but do not count on that as a safety net.
For remote deletion, the Git user manual describes the operation as removing the pointer from the server; servers generally retain underlying data for a time before garbage collection, but retention and recovery are not guaranteed. The Git user manual and Pro Git’s remote-branches chapter provide that context. Record the tip commit and preserve needed work before deletion.
Best Value
Common errors and fixes
- “Cannot delete branch checked out”: switch to another branch in the current worktree, then retry.
- “The branch is not fully merged”: inspect unique commits with
git log main..master, using your intended comparison branch. Merge or preserve needed work; use-Donly if discarding it is deliberate. - Deletion fails because another worktree uses the branch: find the worktree using
masterand switch it to another branch before deleting. - Remote rejects deletion: verify the remote name and branch spelling, then check server hooks, default-branch settings, and branch protections.
origin/masterstill appears afterward: fetch with pruning, or preview cleanup usinggit remote prune --dry-run origin.
Or skip the browser setup
For website screenshots, ScreenshotNeo is a one-request API: it can remove cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed; and its MCP server lets AI agents take screenshots. It includes 1,000 screenshots a month free with no card, with paid plans starting at $5 for 3,000.
Example cURL request (replace YOUR_API_KEY with your key):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for request options. Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →




