Skip to content

jmelosegui/git-sweep

Repository files navigation

git-sweep

A small, cross-platform Go CLI that removes local branches whose upstream has been removed (e.g., branches marked as "[gone]"). Safe by default, dry-run first, and designed for Windows/macOS/Linux.

Installation

Package Managers (planned)

Once published, you’ll be able to install with:

  • Windows (winget)

    winget install jmelosegui.git-sweep
  • macOS (Homebrew Core)

    brew install git-sweep
  • Linux (Debian/Ubuntu via apt)

    sudo apt install git-sweep

Manual install from GitHub Releases (including pre-releases)

  1. Go to the repository Releases page and pick a version. To use a pre-release, select a tag labeled “Pre-release”.
  2. Download the archive matching your OS/arch:
    • linux: git-sweep_<version>_linux_amd64.tar.gz (or _arm64)
    • macOS: git-sweep_<version>_darwin_amd64.tar.gz (or _arm64)
    • Windows: git-sweep_<version>_windows_amd64.zip (or _arm64)
  3. (Recommended) Verify checksum:
    • Download checksums.txt from the same release
    • macOS/Linux:
      # Replace <version>, <os>, and <arch> with the actual values for your downloaded file.
      # Example for version 1.2.3 on Linux amd64:
      shasum -a 256 -c checksums.txt | grep git-sweep_1.2.3_linux_amd64
      # Or, for your specific file:
      shasum -a 256 -c checksums.txt | grep git-sweep_<version>_<os>_<arch>
      
    • Windows PowerShell:
      Get-FileHash .\git-sweep_<version>_windows_amd64.zip -Algorithm SHA256
      # Compare against the corresponding line in checksums.txt
  4. Extract:
    • macOS/Linux:
      tar -xzf git-sweep_<version>_<os>_<arch>.tar.gz
    • Windows PowerShell:
      Expand-Archive .\git-sweep_<version>_windows_amd64.zip -DestinationPath .\git-sweep
  5. Move the binary into your PATH:
    • macOS/Linux (example):
      sudo mv git-sweep /usr/local/bin/
    • Windows (example): add the extracted folder to the "Path" user environment variable, or move git-sweep.exe into a directory already on PATH.
  6. Verify:
    git sweep -V

Usage

Dry-run (default):

git sweep

Execute deletions (interactive confirm if TTY):

git sweep -y

JSON plan output:

git sweep --json

About

Command line tool to removes local branches whose upstream have been deleted.

Resources

License

Stars

Watchers

Forks

Packages

No packages published