Skip to content

blitux/git-navigator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Git Navigator ๐Ÿงญ

(Although name may change in the future)

A lightweight and efficient Git navigation and productivity tool inspired by SCM Breeze

Git Navigator is a modern reimagining of SCM Breeze's core workflow, built in Rust for speed and reliability. It provides numbered file and branch navigation for Git operations, making your Git workflow faster and more intuitive.

A huge thanks to the SCM Breeze team for their pioneering work in this space! It was a core part of my daily workflow, and this project aims to carry that legacy forward as a clean, lean and fast git productivity tool.

I may be wrong, of course. So, feel free to reach out if you have any suggestions or improvements!

Disclaimer: this tool has been put together by using LLM tools. I'm by no means a rust expert, so there may be some gaps.

โœจ Philosophy

  • ๐Ÿงน Clean: Simple, intuitive commands without bloat
  • โšก Fast: Rust performance with efficient Git operations and smart caching
  • ๐Ÿชถ Lean: Zero runtime dependencies, single static binary
  • ๐ŸŽฏ Best UX: Optimized for the 80% use case that developers need daily

๐Ÿ“ฆ Installation

Quick Install (Recommended)

curl -sSL https://raw.githubusercontent.com/blitux/git-navigator/main/install.sh | bash

This one-liner will:

  • ๐Ÿ” Auto-detect your platform (Linux/macOS/Windows, x64/ARM64)
  • ๐Ÿ“ฅ Download the latest release binary
  • ๐Ÿ“ Install to ~/.local/bin and add to PATH
  • โšก Setup shell aliases automatically

Alternative Installation Methods

From Source (Development)

git clone https://github.com/git-navigator/git-navigator
cd git-navigator
./install.sh

Manual Binary Installation

  1. Download the appropriate binary from releases
  2. Extract and move to a directory in your PATH
  3. Add shell aliases manually

Local Development Install

# After making changes
make install-local    # Builds and installs to ~/.local/bin

Shell Aliases (Auto-added by installer)

alias gs='git-navigator status'
alias ga='git-navigator add'
alias gd='git-navigator diff' 
alias grs='git-navigator reset'
alias gco='git-navigator checkout'
alias gb='git-navigator branches'
alias gcb='git-navigator checkout-branch'
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Supported Platforms

  • Linux: x64, ARM64 (glibc and musl)
  • Windows: x64

Unsupported (for now)

    • macOS: Intel (x64), Apple Silicon (ARM64): I have some problems setting up the cross compilation for macos

Shell Compatibility

  • Bash (Linux/macOS/Windows)
  • Zsh (with auto PATH and alias setup)
  • Fish (with proper fish alias syntax)
  • Other POSIX shells

๐Ÿš€ Features

Current (v0.1)

  • โœ… gs - Numbered git status with colored, grouped output
  • โœ… ga [indices] - Add files by index with error handling
  • โœ… gd [indices] - Show diff for indexed files with color output
  • โœ… grs [indices] - Reset files by index from staging area
  • โœ… gco [indices] - Checkout files by index or create branches (-b flag)
  • โœ… gb [index] - Numbered branch list with optional checkout
  • โœ… Smart caching for improved performance
  • โœ… Cross-shell compatibility (bash, zsh, fish)
  • โœ… Flexible index syntax (1, 1-3, 1,3,5, 1 3-5,8)
  • โœ… Modern UI with section grouping and color-coded arrows
  • โœ… Domain-specific error handling with clear user messages
  • โœ… Sub-50ms startup time performance

๐ŸŽฎ Usage

Git Status with Numbers

gs
# Output:
Branch: main
Parent: a1b2c3d Initial commit

โžค Staged:
   (new)       [1] newfile.txt
   (modified)  [2] src/main.rs

โžค Not staged:
   (modified)  [3] src/lib.rs
   (deleted)   [4] oldfile.py

โžค Untracked:
   (untracked) [5] temp.txt

Adding Files by Index

# Add single files
ga 1              # Add file [1]
ga 3              # Add file [3] 

# Add multiple files  
ga 1 2 5          # Add files [1], [2], [5]
ga 1,3,5          # Add files [1], [3], [5]

# Add ranges
ga 2-4            # Add files [2], [3], [4]
ga 1-3,7          # Add files [1], [2], [3], [7]

# Mixed syntax
ga 1 3-5,8        # Add files [1], [3], [4], [5], [8]

All Index Operations Available

# File operations by index
ga 1 3-5,8        # Add files [1], [3], [4], [5], [8]
gd 3              # Diff file [3]  
grs 1-3,7         # Reset files [1], [2], [3], [7]
gco 1 5           # Checkout files [1], [5]

# Branch operations
gb                # List numbered branches
gb 2              # Checkout branch [2]
gco -b new-branch # Create and switch to new branch

๐Ÿ—๏ธ Architecture

src/
โ”œโ”€โ”€ commands/           # Command implementations
โ”‚   โ”œโ”€โ”€ status.rs       # gs command (โœ… 674 lines)
โ”‚   โ”œโ”€โ”€ add.rs          # ga command (โœ… 220 lines)
โ”‚   โ”œโ”€โ”€ diff.rs         # gd command (โœ… 300 lines)
โ”‚   โ”œโ”€โ”€ reset.rs        # grs command (โœ… 161 lines)
โ”‚   โ”œโ”€โ”€ checkout.rs     # gco command (โœ… 229 lines)
โ”‚   โ”œโ”€โ”€ branches.rs     # gb command (โœ… 447 lines)
โ”‚   โ””โ”€โ”€ mod.rs          # Module exports
โ”œโ”€โ”€ core/               # Core functionality  
โ”‚   โ”œโ”€โ”€ colors.rs       # Unified color system with GitStatus enum
โ”‚   โ”œโ”€โ”€ git.rs          # Git operations via git2 library and git commands
โ”‚   โ”œโ”€โ”€ git_status.rs   # GitStatus enum for type safety  
โ”‚   โ”œโ”€โ”€ index_parser.rs # Flexible index parsing logic
โ”‚   โ”œโ”€โ”€ state.rs        # JSON caching and state management
โ”‚   โ”œโ”€โ”€ templates.rs    # Template-based output formatting
โ”‚   โ”œโ”€โ”€ args_parser.rs  # Centralized argument parsing
โ”‚   โ”œโ”€โ”€ error.rs        # Domain-specific error types
โ”‚   โ””โ”€โ”€ output.rs       # Output utilities
โ””โ”€โ”€ main.rs             # CLI entry point with clap

๐Ÿงช Development

Quick Start with Make

# Build release binary
make build

# Run all tests  
make test

# Run the status command
make run

# Development workflow
make format lint test build

Manual Commands

# Build
cargo build --release

# Test
cargo test

# Format and lint
cargo fmt
cargo clippy

Available Make Targets

make help        # Show all available commands
make build       # Build release binary
make test        # Run all tests
make test-int    # Run integration tests only
make run         # Run git-navigator status
make install     # Install binary and aliases
make format      # Format code
make lint        # Run clippy linter
make all         # Format, lint, test, and build

๐ŸŽฏ Comparison with SCM Breeze

Feature SCM Breeze Git Navigator
Language Ruby/Shell Rust
Performance Slow startup Sub-50ms startup
Dependencies Ruby, complex shell setup Single binary
Cross-shell bash/zsh only bash/zsh/fish/etc
Features 100+ commands Essential 20% that matter

๐Ÿค What I keep from SCM Breeze

  • โœ… Numbered file/branch navigation
  • โœ… Flexible index syntax
  • โœ… Colored, readable output
  • โœ… Fast Git workflow

๐ŸŽจ What I'm aming to improve

  • โšก Native performance (Rust vs Ruby/Shell)
  • ๐Ÿ”’ Reliable state management (JSON cache vs environment variables)
  • ๐ŸŒ Cross-shell compatibility
  • ๐Ÿ”ง Zero configuration required

๐Ÿ› ๏ธ Configuration

Git Navigator works out of the box with no configuration required. State is automatically cached in:

  • $XDG_CACHE_HOME/git-navigator/ (Linux/macOS)
  • Per-repository cache using path hashes

๐Ÿš€ Roadmap

Phase 1: Core Commands โšก (COMPLETED)

  • gs - Git status with numbering โœ…
  • ga [indices] - Add files by index โœ…
  • gd [indices] - Show diff for indexed files โœ…
  • grs [indices] - Reset files by index โœ…
  • gco [indices] - Checkout files by index โœ…
  • gb [index] - Numbered branch list with checkout โœ…
  • Domain-specific error handling - Clear user messages โœ…
  • GitStatus enum - Type-safe status system โœ…
  • Template system - Consistent output formatting โœ…
  • String optimizations - Performance improvements โœ…

Phase 2: Future Enhancements ๐Ÿ”—

  • Custom color themes and configuration
  • TUI mode for interactive navigation
  • Maybe more!

๐Ÿค Contributing

Contributions welcome! Please see the development setup above.

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments

Inspired by SCM Breeze - Thank you for pioneering numbered Git navigation!

About

A lightweight and efficient Git navigation tool inspired by SCM Breeze

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •