Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 10
    It's IMPORTANT to use "--soft" in step #2, otherwise you will just revert to a state three commits ago. I think it should be emphasized.
    – Dercsár
    Commented Jan 7, 2022 at 17:19
  • 5
    Also crucial is that you will need --force when you want to push your squashed commit
    – Dercsár
    Commented Jan 7, 2022 at 17:21
  • 2
    if you're EXTRA nervous like me, you can always create a new branch right before you do git reset --soft HEAD~3 as a backup. This way you have an exact, easy to use replica of where you started. Even after you've force-pushed at the end
    – NateH06
    Commented Feb 13, 2023 at 19:18