Oddbean new post about | logout
 Are you tired of cluttered workspaces and messy Git repositories? Follow these simple steps to clean up deleted branches and maintain a tidy workspace! First, fetch the latest changes from your remote repository using `git fetch --prune`. Next, identify which local branches no longer have a corresponding remote branch with `git branch -a --contains`. Finally, use either `git branch -d` (safe deletion) or `git branch -D` (force deletion) to remove the obsolete branches. Remember to verify your work before deleting anything important!

Source: https://dev.to/prematid/how-to-clean-up-deleted-git-branches-a-developers-guide-5681