How do I undo my last Git commit without losing the changes I made?

0votes

Working on a feature branch in a local Git repository. I ran git commit -m "WIP" before finishing the change, and I have NOT pushed the commit anywhere yet.

I want to remove the last commit from the branch history but keep all the edited files exactly as they were, so I can finish the work and make a clean commit.

I'm not sure whether to use git reset --soft, --mixed, --hard, or git revert, and I'm worried the wrong one will permanently delete my changes.

Question comments

Short clarifications and follow-ups about the question itself.

No comments yet.

0 Answers

No answers yet

There are no published answers to show.

Your answer

Sign in to share a solution.