Skip to content

CLI tool to detect and remove stale local Git branches — safe, fast, and built with Go for cross-platform use.

License

Notifications You must be signed in to change notification settings

hadzicni/gitclean-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧹 GitClean CLI

A simple CLI tool written in Go to identify and optionally delete stale local Git branches that no longer exist on the remote. Keeps your local Git repo clean and manageable.

Go Version License Platform


✨ Features

  • 🔍 Detects stale local branches by comparing against a remote
  • 🗑️ Optionally delete stale branches via --delete
  • 🌐 Supports custom remotes (default: origin)
  • ⚙️ Pure Go with minimal code and no dependencies
  • 🔒 Never deletes main or master branches

📦 Installation

Option 1: Go Install

go install github.com/hadzicni/gitclean-cli/cmd/gitclean@latest

Make sure $GOPATH/bin is in your $PATH.

Option 2: Manual Build (Windows, Linux, macOS)

🪟 Windows (PowerShell oder CMD)

git clone https://github.com/hadzicni/gitclean.git
cd gitclean/cmd/gitclean
go build -o gitclean.exe

🐧 Linux / 🍏 macOS

git clone https://github.com/hadzicni/gitclean.git
cd gitclean/cmd/gitclean
go build -o gitclean

🚀 Usage

gitclean [flags]

Available Flags

Flag Description
--delete, -d Delete all stale local branches
--remote, -r Specify remote to compare against (default: origin)

🔧 Examples

List stale branches:

gitclean

List using a custom remote:

gitclean -r upstream

Delete all stale branches:

gitclean -d

👨‍💻 Author

Made by Nikola Hadzic
GitHub: @hadzicni


📄 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

About

CLI tool to detect and remove stale local Git branches — safe, fast, and built with Go for cross-platform use.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages