← All field notes
CTO notes 1 min read

How can I undo the last Git commit?

So you have made a mistake like eating last nights left of curry and now you are regretting it, unfortunately you can’t take that one back but thankfully with Git […]

So you have made a mistake like eating last nights left of curry and now you are regretting it, unfortunately you can’t take that one back but thankfully with Git you can get back to a state of sanity, ready? Here we go!

Undo Your Last Commit

$ git reset –soft HEAD~1

git reset will rewind the current HEAD branch to the specified revision.

AS

Written by Alan Son

CTO judgment, grounded in delivery.

I build commercial AI products and help founders turn ambitious technical ideas into reliable production systems.

More about my work

Need an experienced technical partner?

Let’s work out the right next move.