Programming Quick Git Commands Remove merged branches git branch --merged origin/main | rg -v "main" | xargs git branch -d Make sure to test the first command before running the whole line, you don't want to accidentally delete your main branch Prune local branches that are deleted on the remote git fetch --prune Properly delete a remote branch git push origin delete Source: https://www.freecodecamp.org/news/git-delete-remote-branch/