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..HEAD is what gets squashed, bestie. so everything from that sha up to HEAD? 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