Skip to main content

Automatically reorganize messy git commit histories into clean, semantic commits

Project description

Git Smart Squash

Transform your messy commit history into clean, logical commits that reviewers will love! 🎯

Why Use Git Smart Squash?

Ever spent 30 minutes reorganizing commits before a PR? We've all been there. Git Smart Squash uses AI to automatically organize your changes into logical, well-structured commits in seconds.

✨ What It Does

Before (your typical feature branch):

* 7f8d9e0 fix tests
* 6c5b4a3 typo
* 5a4b3c2 more auth changes
* 4d3c2b1 WIP: working on auth
* 3c2b1a0 update tests
* 2b1a0f9 initial auth implementation

After (AI-organized commits):

* a1b2c3d feat: implement complete authentication system with JWT tokens
* e4f5g6h test: add comprehensive test coverage for auth endpoints

The AI analyzes your entire diff and groups related changes together, creating clean commit messages that follow conventional commit standards.

🚀 Quick Start (2 minutes)

1. Install

pip install git-smart-squash

2. Set up AI (choose one)

Option A: Local AI (Free & Private) - Default for Privacy

# Install Ollama from https://ollama.com
ollama serve
ollama pull devstral

Option B: Cloud AI (if you have API keys)

export OPENAI_API_KEY="your-key"      # or
export ANTHROPIC_API_KEY="your-key"   # or
export GEMINI_API_KEY="your-key"

3. Use It!

cd your-git-repo
git checkout your-feature-branch

# Preview what it will do (safe by default!)
git-smart-squash

# Apply the changes when ready
git-smart-squash --apply

That's it! Your commits are now beautifully organized. 🎉

💡 Common Use Cases

"I need to clean up before PR review"

git-smart-squash         # See the plan (dry run by default)
git-smart-squash --apply # Apply it

"I work with a different main branch"

git-smart-squash --base develop

"I want to use a specific AI provider"

git-smart-squash --ai-provider openai

"I use the short command"

gss  # Same as git-smart-squash

🛡️ Safety First

Don't worry - Git Smart Squash is designed to be safe:

  • Dry run by default - always shows you the plan first
  • Always creates a backup branch before making changes
  • Never pushes automatically - you stay in control
  • Easy recovery - your original commits are always saved

If You Need to Undo

# Your original branch is always backed up
git branch | grep backup  # Find your backup
git reset --hard your-branch-backup-[timestamp]

🤖 AI Provider Options

Provider Cost Privacy Setup
Ollama (default) Free 100% Local ollama pull devstral
OpenAI ~$0.01/use Cloud Set OPENAI_API_KEY
Anthropic ~$0.01/use Cloud Set ANTHROPIC_API_KEY
Gemini ~$0.01/use Cloud Set GEMINI_API_KEY

The local Ollama option is perfect for most users - it's free, private, and works great!

⚙️ Advanced Configuration (Optional)

Want to customize? Create a config file:

Project-specific (.git-smart-squash.yml in your repo):

ai:
  provider: openai  # Use OpenAI for this project

Global default (~/.git-smart-squash.yml):

ai:
  provider: local   # Always use local AI by default

🔍 Troubleshooting

"Ollama not found"

Install Ollama from https://ollama.com and run:

ollama serve
ollama pull devstral

"No changes to reorganize"

Make sure you're on your feature branch with uncommitted work:

git status  # Should show differences from main

"Large diff taking too long"

The AI might timeout on huge changes. Try:

  • Breaking your work into smaller chunks
  • Using --base with a more recent commit

Need More Help?

Check out our detailed documentation or open an issue!

📚 Learn More

License

MIT License - see LICENSE file for details.


Made with ❤️ for developers who want cleaner git history

PS: Your git log will never be the same! 🚀

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_smart_squash-3.4.2.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_smart_squash-3.4.2-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file git_smart_squash-3.4.2.tar.gz.

File metadata

  • Download URL: git_smart_squash-3.4.2.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for git_smart_squash-3.4.2.tar.gz
Algorithm Hash digest
SHA256 0806fe38358c5133d3e01972d64a79eadcddf7a3441884b8ea6bc039646ce768
MD5 58333551cb39affe35cfd7fb203138bb
BLAKE2b-256 e2aa5e7b4f04467efe47f85c99fa535350281448a2bd01248636942953da9ec4

See more details on using hashes here.

File details

Details for the file git_smart_squash-3.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for git_smart_squash-3.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 942ee46e1209a4a63cce11316cc11ecee473554aa4a0888ba97010dfeabeec7f
MD5 46f87b932f433c897fa1ff077316abac
BLAKE2b-256 c322e472bc3d48ced2e331afc1ad733fc27608763abfbbb3392d16c0324a4195

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page