How do I undo the most recent local commits in Git?

how do i undo the commits in git 2024

Undo a commit & redo git reset –hard <commit_id> “Move” your HEAD back to the desired commit. Alternatively, to edit the previous commit or just its commit message, use git commit –amend. This will add the changes from the current index to the previous commit. To eliminate (not undo) a commit that has been pushed … Read more