

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Squashing
incomplete
2: How to Squash
incomplete
3: Overwrite
incomplete
4: Force Push
incomplete
5: Squashing Is Scary
incomplete
6: Squashing PRs
incomplete
7: Squash Series
incomplete
8: Pull Request
incomplete
9: Merge the Pull Request
incomplete
This lesson's interactive features are locked, please to keep using them
Perhaps confusingly, squashing is done with the git rebase command! Here are the steps to squash the last n commits:
git rebase -i HEAD~n, where n is the number of commits you want to squash.pick to squash for all but the first commit.The -i flag stands for "interactive," and it allows us to edit the commit history before Git applies the changes. HEAD~n is how we reference the last n commits. HEAD points to the current commit (as long as we're in a clean state) and ~n means "n commits before HEAD."
Remember, rebase is all about replaying changes. When we rebase onto a specific commit (HEAD~n), we're telling Git to replay all the changes from the current branch on top of that commit. Then we use the interactive flag to "squash" those changes so that Rebase will apply them all in a single commit.
MegaCorp executives do not like your last few commits. As a result, your manager has told you to squash your last 3 commits (J, L, and K) into a new single commit with the message J: redacted.
Squashing is a destructive operation, which is why you've decided to make the change on temp_main before moving it to main.
Run and submit the CLI tests.