Skip to content

Fix squash command in cheat sheet (HEAD~6 → HEAD~5) - #2192

Merged
dscho merged 1 commit into
git:gh-pagesfrom
lindanigs:fix-cheat-sheet-squash-head
Aug 3, 2026
Merged

Fix squash command in cheat sheet (HEAD~6 → HEAD~5)#2192
dscho merged 1 commit into
git:gh-pagesfrom
lindanigs:fix-cheat-sheet-squash-head

Conversation

@lindanigs

Copy link
Copy Markdown
Contributor

Changes

  • Fixed the squash example in the cheat sheet: git rebase -i HEAD~6git rebase -i HEAD~5

Context

Hi there, I'm learning Git and found this while playing around in my terminal.

The heading says "Squash the last 5 commits into one," but the command used git rebase -i HEAD~6, which lists 6 commits instead of 5. In a repo with only 6 total commits, this actually throws fatal: invalid upstream 'HEAD~6', since there's no commit further back than the root.

Changed it to HEAD~5 to match the heading and the actual number of commits being squashed.

Hi there, I'm learning Git and found this while playing around in my terminal.

The heading says "Squash the last 5 commits into one," but the command used git rebase -i HEAD~6, which lists 6 commits instead of 5. In a repo with only 6 total commits, this actually throws fatal: invalid upstream HEAD~6, since there's no commit further back than the root.

Changed it to HEAD~5 to match the heading and the actual number of commits being squashed.
@dscho

dscho commented Aug 3, 2026

Copy link
Copy Markdown
Member

Confirmed!

@dscho
dscho merged commit e7cb056 into git:gh-pages Aug 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants