gitclean() { git clean -Xdn if read -q REPLY\?"Clean these? (Y/y)"; then git clean -Xdf else echo "Still dirty." fi }
For more fancy, use "gum":
gitclean() { DIRTY=$(git clean -Xdn | sed 's/Would remove //g') gum style \ --foreground 196 --border thick --border-foreground 88 \ --margin "1 2" --padding "1 3" "$DIRTY" gum confirm "🧹 Delete these?" \ && git clean -Xdf \ || echo "Still dirty." }
gist version with preview image
---