nvie / git-toolbelt

A suite of useful Git commands that aid with scripting or every day command line usage
BSD 3-Clause "New" or "Revised" License
1.25k stars 111 forks source link

git cleanup with flags seem to just print the helpscreen. #59

Closed kitsunde closed 1 year ago

kitsunde commented 1 year ago

I did a homebrew install, and I have coreutils. Not sure why but I'm just getting this:

➜  src git:(master) git cleanup -n
usage: git cleanup [-lr] [-nsvh]

Deletes all branches that have already been merged into the main branch.
Removes those branches both locally and in the origin remote.  Will be
most conservative with deletions.

Options:
-l    Remove local branches
-r    Remove remote branches (in `origin`)
-n    Dry-run
-s    Also consider squash merges (implies -l)
-v    Be verbose (show what's skipped)
-h    Show this help

I was trying to understand if I could set branches to skip in config since I don't want it to delete origin/release or origin/main.

nvie commented 1 year ago

Hi @kitsunde — this is working as intended. The issue is that you need to specify either -l or -r (or both).

Screen Shot 2023-06-23 at 14 07 15@2x

These flags define whether to delete branches locally or remotely. I wasn't comfortable picking a default for a destructive action like this, that's why those flags must be specified. Hope that helps to explain.

nvie commented 1 year ago

Updated the help text to better explain that in 16f6792de42d9c3ec93b0d61e31acff132d301a2 — thanks for the report! 👍