1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 22:57:46 +00:00
nu_scripts/modules/git/git_branch_cleanup.md
Eric Hodel db9606af6c
Improve git branch cleanup script (#685)
This implementation prunes local branches that have been merged and
optionally prunes remote branches that have been merged.

The script may be configured to keep branches through local git
configuration.

The remote name can be autocompleted.
2023-12-10 09:05:57 -06:00

22 lines
440 B
Markdown

# Git branch cleanup
Remove any local git branches that have been merged and optionally remove any
remote branches that have been merged.
Load with:
```nushell
source modules/git/git_branch_cleanup.nu
```
To remove merged branches:
```nushell
git branch-cleanup
```
To keep merged branches that start with "releases/":
```nushell
git config --local --add branch-cleanup.keep 'releases/.*'
```
Keep branch patterns are space-separated