# Quick Git Commands

Remove merged branches

```bash
git branch --merged origin/main | rg -v "main" | xargs git branch -d
```

<p class="callout warning">Make sure to test the first command before running the whole line, you don't want to accidentally delete your main branch</p>

Prune local branches that are deleted on the remote

```bash
git fetch --prune
```

Properly delete a remote branch

```bash
git push origin delete <remote name> <branch>
```

Source: https://www.freecodecamp.org/news/git-delete-remote-branch/