mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00

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.
22 lines
440 B
Markdown
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
|