This guide explains how to remove the last two commits from your branch and restore the state to the third commit from the end (keeping your working tree clean and history intact).
- You're on a feature branch (e.g.,
feature/add-auth
) based onmain
- You've made 4 commits
- You want to remove the last 2 commits, keeping the state from the third last commit