git-x 0.4.0

CLI extensions for Git that simplify common workflows
Documentation

πŸš€ git-x – Superpowers for Git CI codecov

git-x is a collection of smarter, faster, and more intuitive Git subcommands built to make your daily workflow suck less.

It wraps common Git actions in muscle-memory-friendly, no-brainer commands β€” perfect for solo developers, team leads, and anyone tired of typing git log --oneline --graph --decorate --all for the 400th time.

⚠️ PSA: Do you know shell tab completion? If so - I need your help! πŸ™ See the Tab Completion section ⚠️


πŸ“š Table of Contents


Why Does This Exist?

Git is powerful, but its UX is stuck in the early 2000s.

You're probably asking:

  • β€œWhy is this branch here?”
  • β€œWhat changed since I last pushed?”
  • β€œCan I just get a clean, visual summary of this repo?”
  • β€œHow do I undo that commit without wrecking everything?”

Most Git tools either:

  • Show too much (spammy logs, unreadable diffs)
  • Show too little (cryptic one-liners with no context)
  • Or require memorizing a dozen flags

git-x fixes that by giving you opinionated, purpose-built subcommands that just do the thing.

πŸ’‘ Want to see git-x in action? Check out our Real-World Scenarios document to see exactly how git-x commands solve everyday developer problems like code review cleanup, branch naming mistakes, urgent context switching, and complex remote workflows.


Installation

cargo install git-x

Or clone and run manually:

git clone https://github.com/simeg/git-x
cd git-x
cargo install --path .

Example Commands


clean-branches

Delete all fully merged local branches (except protected ones)

git x clean-branches

Output:

🧹 Deleted 5 merged branches:
- feature/refactor
- bugfix/signup-typo
...

color-graph

Colorized Git log with branches, remotes, HEADs, and author info

git x color-graph

Output:

Enhanced version of git x graph with:

  • Full color support for branches, commits, and decorations
  • Author names and timestamps for each commit
  • Rich formatting that's easy to scan

(essentially wraps this)

git log --oneline --graph --decorate --all --color=always --pretty=format:"%C(auto)%h%d %s %C(dim)(%an, %ar)%C(reset)"

fixup

Create fixup commits for easier interactive rebasing

git x fixup abc123
git x fixup abc123 --rebase

Output:

πŸ”§ Creating fixup commit for abc123...
βœ… Fixup commit created for abc123
πŸ’‘ To squash the fixup commit, run: git rebase -i --autosquash abc123^

Flags:

  • --rebase β€” Automatically start interactive rebase with autosquash after creating fixup

Creates a fixup commit that can be automatically squashed during interactive rebase. Requires staged changes.


graph

Pretty Git log with branches, remotes, and HEADs

git x graph

Output:

(essentially wraps this)

git log --oneline --graph --decorate --all

health

Check repository health and identify potential issues

git x health

Output:

Repository Health Check
=========================

βœ“ Working directory is clean
βœ“ No untracked files
βœ“ No stale branches (older than 1 month)
βœ“ Repository size: 524K (healthy)
βœ“ No staged changes

Health check complete!

What it checks:

  • Working directory status - Detects uncommitted changes
  • Untracked files - Counts files not under version control
  • Stale branches - Identifies branches older than 1 month
  • Repository size - Warns about large repositories that may need cleanup
  • Staged changes - Shows files ready for commit

Useful for:

  • Daily repository maintenance
  • Pre-commit health checks
  • Identifying cleanup opportunities
  • Team onboarding (ensuring clean local state)

info

Show a high-level overview of the current repo

git x info

Output:

Repo: my-project
Branch: feature/auth
Tracking: origin/feature/auth
Ahead: 2 Behind: 0
Last Commit: "fix login bug" (2 hours ago)

large-files

Find largest files in repository history

git x large-files
git x large-files --limit 20 --threshold 5

Output:

πŸ” Scanning repository for large files...

πŸ“ Largest files in repository history:
  15.2 MB  assets/video.mp4
   8.7 MB  docs/presentation.pdf
   3.1 MB  images/hero-banner.png

πŸ’‘ Found 3 files larger than 1.0 MB

Flags:

  • --limit <number> β€” Number of files to show (default: 10)
  • --threshold <MB> β€” Minimum file size in MB to include

Useful for identifying large files that may be slowing down your repository.


new

Create and switch to a new branch

git x new feature-branch
git x new hotfix --from main

Output:

🌿 Creating branch 'feature-branch' from 'current-branch'...
βœ… Created and switched to branch 'feature-branch'

Flags:

  • --from <branch> β€” Base the new branch off a specific branch instead of current

Validates branch names and prevents common Git naming issues.


prune-branches

Deletes all local branches that have already been merged into the current branch, while skipping protected ones.

Useful for keeping your repo tidy after merging feature branches.

Defaults:

  • Protected branches: main, master, develop
  • Won't delete current branch
  • Will only delete branches that are fully merged

Flags:

  • --except <branches> β€” Comma-separated list of branch names to exclude from deletion
git x prune-branches --except "release,v1.0-temp"

rename-branch

Rename the current branch locally and on remote

git x rename-branch new-feature-name

Output:

πŸ”„ Renaming branch 'old-name' to 'new-feature-name'...
βœ… Branch renamed successfully

Safely renames your current branch by:

  • Renaming the local branch
  • Updating the remote tracking branch
  • Cleaning up old remote references

since [ref]

Show commits since a reference (e.g., d926b4b, my-branch, origin/main)

git x since origin/main

Output:

πŸ” Commits since origin/main:
- 8f2d9b3 fix login bug
- b41a71e add auth test

stash-branch

Advanced stash management with branch integration

git x stash-branch create new-feature
git x stash-branch clean --older-than 7d
git x stash-branch apply-by-branch feature-work

Subcommands:

create <branch-name> β€” Create a new branch from a stash

  • --stash <ref> β€” Use specific stash (default: latest)

clean β€” Clean up old stashes

  • --older-than <time> β€” Remove stashes older than specified time
  • --dry-run β€” Show what would be cleaned without doing it

apply-by-branch <branch-name> β€” Apply stashes from a specific branch

  • --list β€” List matching stashes instead of applying

Helps manage stashes more effectively by associating them with branches.


summary

Show a short, changelog-style summary of recent commits

git x summary
git x summary --since "2 days ago"

Flags:

  • --since β€” Accepts natural date formats like "2 days ago", "last Monday", or exact dates like "2025-07-01". It uses Git's built-in date parser, so most human-readable expressions work.

Output:

πŸ—žοΈ Commit summary since 3 days ago:

πŸ“… 2025-07-25
 - πŸ›  fix: update token refresh logic (by Alice, 3 hours ago)
 - ✨ feat: add dark mode support (by Bob, 6 hours ago)

πŸ“… 2025-07-24
 - πŸ”₯ remove unused dependencies (by Alice, 1 day ago)

πŸ“… 2025-07-23
 - πŸ› fix: handle null response in API call (by Carol, 2 days ago)
  • Groups commits by day
  • Shows commit message, author, and relative time
  • Useful for writing daily stand-ups, changelogs, or review summaries
  • Defaults to showing commits from the last 3 days
  • Can be customized using --since (e.g. --since "1 week ago")
  • Sorts commits newest-first within each day

sync

Sync current branch with upstream (fetch + rebase/merge)

git x sync
git x sync --merge

Output:

πŸ”„ Syncing branch 'feature' with 'origin/feature'...
⬇️ Branch is 2 commit(s) behind upstream
βœ… Successfully rebased onto upstream

Flags:

  • --merge β€” Use merge instead of rebase for integration

Automatically fetches from remote and integrates upstream changes into your current branch.


undo

Undo the last commit (without losing changes)

git x undo

Output:

Last commit undone (soft reset). Changes kept in working directory.

upstream

Manage upstream branch relationships

git x upstream status
git x upstream set origin/main
git x upstream sync-all --dry-run

Subcommands:

status β€” Show upstream status for all branches

πŸ”— Upstream status for all branches:
* main -> origin/main
  feature -> (no upstream)
  hotfix -> origin/hotfix

set <upstream> β€” Set upstream for current branch

sync-all β€” Sync all local branches with their upstreams

  • --dry-run β€” Show what would be synced without doing it
  • --merge β€” Use merge instead of rebase

Streamlines upstream branch management across your entire repository.


what [branch]

Show what's different between this branch and another (default: main)

git x what
git x what develop

Output:

Branch: feature/new-ui vs main
+ 4 commits ahead
- 2 commits behind
Changes:
 - + new_ui.js
 - ~ App.tsx
 - - old_ui.css

Command Transparency

git-x believes in complete transparency β€” there's no magic, no hidden behavior, and no surprise side effects.

Every git-x command is a thin wrapper around standard Git operations that you could run yourself. Want to know exactly what's happening under the hood? Check out our Command Internals Documentation.

Why this matters:

  • Trust β€” You can verify every operation before and after
  • Learning β€” Understand the Git commands you're actually running
  • Debugging β€” When something goes wrong, you know exactly what to investigate
  • Portability β€” You can replicate any git-x workflow with plain Git

Example: When you run git x graph, it literally executes:

git log --oneline --graph --decorate --all

No database calls, no hidden state, no magic β€” just Git doing Git things, with better UX.


Git Integration: How git-x Just Worksβ„’

Since git-x is installed as a standalone binary, Git automatically recognizes it as a subcommand when you type git x [command].

This is Git's standard extension mechanism β€” no configuration needed.

How it works:

  1. You run git x info
  2. Git looks for an executable called git-x in your $PATH
  3. Git runs git-x info and displays the output

Why this rocks:

  • Zero setup required
  • Works in any Git repo
  • Integrates seamlessly with your existing Git workflow
  • All your Git aliases, hooks, and config still work

What's Under the Hood?

git-x is a thin, opinionated wrapper around native Git commands.

Philosophy:

  • No magic β€” Every git-x command maps to standard Git operations
  • Readable β€” You can see exactly what Git commands are being run
  • Predictable β€” Follows Git's existing patterns and conventions
  • Fast β€” Minimal overhead, direct subprocess calls

Example: git x graph literally runs:

git log --oneline --graph --decorate --all

Why Rust?

  • Fast startup β€” Sub-millisecond command execution
  • Zero dependencies β€” Single binary, no runtime requirements
  • Cross-platform β€” Works on macOS, Linux, Windows
  • Memory safe β€” No crashes, no memory leaks

Roadmap Ideas

  • git x stash: A smarter stash viewer with preview
  • git x prune: Aggressively delete stale branches (with dry-run)
  • git x inspect: Interactive blame / file history explorer

🚧 Tab Completion 🚧

I'm looking for help to get tab completion working! πŸ†˜ By that I mean git x <TAB> should show available commands. I've given it my best shot without success πŸ˜… so if anyone can help, that would be much appreciated!

Your shell expertise could make git-x so much more pleasant to use!


Built With

  • Language: Rust πŸ¦€
  • Shell: Integrates cleanly with Bash, Zsh, Fish, etc.
  • Uses: native git under the hood β€” no black magic

License

MIT