Last active
February 25, 2026 10:50
-
-
Save jelc53/6130fe28326b5d37ecca8019cd893b6d to your computer and use it in GitHub Desktop.
step-by-step procedure for how to cleanly squash and rebase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Here's how to squash and cleanly rebase against upstream branch: | |
| # 1. Soft reset to the merge-base (keeps your changes staged) | |
| git reset --soft $(git merge-base main HEAD) | |
| # 2. Commit everything as one squashed commit | |
| git commit -m "Your squashed commit message" | |
| # 3. Rebase onto current main | |
| git rebase main # resolve merge conflicts once | |
| git push --force-with-lease |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment