Add command to prune (upstream gone).

Adam Sherwood 2024-04-02 10:59:31 +02:00
parent fdb604729e
commit 553a095288

@ -147,6 +147,20 @@ customCommands:
description: "prune local branches that have been merged to master"
```
## Pruning branches no longer on the remote.
Implementation inspiration [here on Stackoverflow](https://stackoverflow.com/a/33548037/2081835). Basically, delete all the branches displaying `(upstream gone)`.
```yml
customCommands:
- key: "G"
command: |
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
context: "localBranches"
description: "Prune local branches no longer on its remote; (G)one."
loadingText: "Pruning gone..."
```
## committing via [Commitizen](https://commitizen-tools.github.io/commitizen/) (`cz c`)
```yml