GIT undo a commit that isn’t the most recent, rebase all commits since

The easiest way to do what you want is to stay on (or re-checkout) the branch that you want to edit and run something like this.

git rebase --onto <sha1-of-bad-commit>^ <sha1-of-bad-commit>

This will rebase everything since the bad commit onto the bad commit’s parent, effectively removing the bad commiit from your current branch’s history. Of course you will need to resolve any conflicts if they occur.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)