GitSweep.Cli 1.2.0

dotnet tool install --global GitSweep.Cli --version 1.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local GitSweep.Cli --version 1.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=GitSweep.Cli&version=1.2.0
                    
nuke :add-package GitSweep.Cli --version 1.2.0
                    

GitSweep

Build Release NuGet Version NuGet Downloads License

GitSweep icon

GitSweep is an interactive .NET CLI for finding and cleaning local Git branches that are already merged or stale. It uses Spectre.Console for a colorful TUI with scan summaries, candidate tables, confirmation prompts, progress bars, and readable error messages.

Requirements

  • .NET 10 SDK for local development
  • Git available on the command line

Install

dotnet tool install --global GitSweep.Cli

Or install the npm wrapper:

npm install --global @stescobedo9205/gitsweep-cli

Update an existing install:

dotnet tool update --global GitSweep.Cli
npm update --global @stescobedo9205/gitsweep-cli

Quick Start

# Analyze the current repository, then choose branches interactively.
gitsweep

# Same command through the explicit subcommand.
gitsweep clean

# Preview candidates without deleting anything.
gitsweep clean --dry-run

Usage Examples

# Analyze another repository and consider branches stale after 3 months.
gitsweep clean -p C:/code/my-repo -a 3

# Show only branches already merged into the default branch.
gitsweep clean -p C:/code/my-repo --merged-only

# Show only stale branches older than 12 months.
gitsweep clean -p C:/code/my-repo --stale-only --age 12

# Automation-friendly cleanup: select all merged branches and skip confirmation.
gitsweep clean --merged-only --all --yes

# Preview what an automation run would delete.
gitsweep clean --stale-only --age 6 --all --dry-run

# Use a relative path and default stale age.
gitsweep clean -p ../other-repo

Options

Option Description
-p, --path Repository path. Defaults to the current directory.
-a, --age Months after which a branch is stale. Defaults to 6.
--dry-run Show candidates without deleting branches.
--merged-only Only include branches merged into the target branch.
--stale-only Only include stale branches.
--all Select every listed candidate without opening the picker.
-y, --yes Skip final confirmation. Must be used with --all.

How It Works

  • GitSweep.Cli hosts the Spectre.Console CLI and interactive TUI.
  • GitSweep.Core owns contracts and models such as BranchInfo, IBranchAnalyzer, and IGitRepositoryService.
  • GitSweep.Infrastructure runs Git commands and keeps command-line process details out of the UI layer.
  • Merged branches are detected with git branch --merged <target>.
  • Stale branches are branches whose last commit is older than the configured age and are not already classified as merged.

GitSweep deletes branches with safe local deletes (git branch -d). If Git refuses because a branch is not fully merged, GitSweep reports the failure and leaves the branch intact.

Development

dotnet restore
dotnet build
dotnet test
dotnet run --project GitSweep.Cli -- clean --dry-run

Pack the CLI tool locally:

dotnet pack GitSweep.Cli/GitSweep.Cli.csproj -c Release -p:Version=0.0.0-local

Releases

Releases are automated with Release Please and Conventional Commits:

  • fix: creates a patch release.
  • feat: creates a minor release.
  • feat!: or BREAKING CHANGE: creates a major release.

When changes land on master, GitHub Actions calculates the next SemVer, packs GitSweep.Cli as a .NET tool, publishes it to nuget.org, publishes @stescobedo9205/gitsweep-cli to npm, and creates the GitHub release. The workflow currently uses the NUGET_ORG_NEW_API_KEY secret for both registry publishes.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.2.0 101 5/18/2026
1.1.0 103 5/18/2026