Git Clients

git-trim – keep Git working directories clear of stale local branches

git-trim is a command-line utility that helps keep Git working directories clear of stale local branches.

It analyses tracking branches against their upstream and base branches, identifying branches that have already been merged, branches whose upstream has disappeared, and cases where a remote branch can also be removed after a merge.

The tool is intended as a safer companion to git fetch --prune. While Git’s prune operation removes remote-tracking references, git-trim also deals with the corresponding local tracking branches, avoiding the need for fragile shell one-liners or repeated manual branch deletion after pull requests have been merged or closed.

This is free and open source software.

Key Features

  • Detects local tracking branches whose upstream branches have been merged or removed.
  • Provides a dry-run mode so users can review the branches that would be deleted.
  • Supports common merge styles including merge commits, fast-forward merges, rebase merges, and squash merges.
  • Can remove forgotten remote branches when configured to do so.
  • Supports GitHub flow, git-flow, simple workflows, and triangular workflows.
  • Runs checks in parallel, helping with repositories that contain many stale branches.
  • Offers configurable base branches, protected branch patterns, confirmation behaviour, and update intervals.
  • Cross-platform support – runs under Linux, macOS, and Windows.

Website: github.com/foriequal0/git-trim
Support:
Developer: SeongChan Lee
License: MIT License

git-trim demo
Click animation for full size

git-trim is written in Rust. Learn Rust with our recommended free books and free tutorials.


Best Free and Open Source Software Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.

This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more.

Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments