GIT-SQUASH(1)
β¨ GIT-SQUASH β bestie edition β¨
okay so this is git-squash, part of the Git Extras crew π it does one thing and it ATE: squash N last changes up to a ref'ed commit. iconic behaviour, truly.
πΈ NAME πΈ
git-squash β squash N last changes up to a ref'ed commit
π¦ SYNOPSIS π¦
ngl bestie, the original page leaves this section completely blank β no synopsis line at all π so we're just gonna vibe here and let the OPTIONS and EXAMPLES do the talking. scroll down, it's giving everything you need.
π DESCRIPTION π
So here's the tea π«: git-squash squashes the N last changes in your current branch. And what is N, you ask? N is literally the range of commits from the ref you hand it all the way up to HEAD. That's it. That's the whole job. main character energy, no notes.
β¨ OPTIONS β¨
<source-branch>β the branch you wanna squash onto your current branch.sha..HEADis what gets squashed, bestie. so everything from that sha up toHEAD? gone, merged, squashed, slay.<--squash-msg>β commits the squash result using the concatenated messages of all the commits you squashed together π lowkey a little message-merging queen. but β and this is important β you can not use this one together with<commit-message>. pick a lane, bestie π<commit-message>β if you give it a commit message, it commits the squashed result for you π«Ά. if you don't, then the squash just stays chilling in the index β added but not committed. no commit, no problem, it's just sitting there waiting for you to do it yourself π
π₯ EXAMPLES π₯
squash changes and follow up with a separate commit step
$ git squash my-other-branch
Updating a2740f5..533b19c
Fast-forward
Squash commit -- not updating HEAD
my-changed-file | 1 +
1 file changed, 1 insertion(+)
$ git commit -m "New commit without a real merge"
squash and commit with a given message
$ git squash HEAD~3 "Commit message"
squash and commit and concatenate all messages
$ git squash --squash-msg @~3
the --squash-msg one is the "I don't wanna write a message" move and honestly? valid π
π AUTHOR π
Written by JesΓΊs Espino <jespinog@gmail.com> β thank you for your service, legend πβ
π REPORTING BUGS π
found a bug? don't suffer in silence bestie, go here:
<https://github.com/tj/git-extras/issues>
we'll get it fixed, fr fr ππ§
π SEE ALSO π
<https://github.com/tj/git-extras>
that's the mothership, go explore π¦πΈ
β οΈ little heads up, bestie:<--squash-msg>and<commit-message>are mutually exclusive. the original says the one cannot be used together with the other. so don't come crying to me when you try both at once π
and that's the whole page!! this was Git Extras, page GIT-SQUASH(1), dated May 2026 β go squash something and make it look effortless π
β¨π pookie out π«Ά
π¦ where this page comes from
- ubuntu stonking: git-extras 7.5.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms