Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 1.2 KB

File metadata and controls

57 lines (43 loc) · 1.2 KB

git-squash

A simple and powerful Git plugin to squash your commits before creating a Pull Request.

This tool provides a unified interface to squash commits:

  • By base branch name (e.g., main, master)
  • By number of recent commits
  • By specific commit SHA

🚀 Installation

   brew install ian729/tap/git-squash

Usage

git squash <base-branch>
git squash <number-of-commits>
git squash --sha <commit-sha>

Examples

✅ Squash all commits made since branching from main:

git squash main

✅ Squash the last 3 commits:

git squash 3

✅ Squash all commits made since a specific commit:

git squash --sha <commit-sha>

Note

  • This tool uses git reset --soft, preserving your working directory and staging area.

  • After squashing, use git push --force-with-lease to update the remote branch:

    git push --force-with-lease
  • Default commit message is Squashed commit, but you can provide a custom message during the prompt.

🛠️ Why use git-squash?

  • Keep your PR history clean.

  • Avoid git rebase -i complexity in simple squash workflows.

  • Fast, scriptable, and beginner-friendly.

📄 License

MIT License