DEV Community

Discussion on: Want to remove/delete your last commit? Here is how.

Collapse
 
dawidtabak profile image
Dawid Tabak

You could slightly shorten the first command with

git reset --soft HEAD^

This is especially handy when using git in powershell cli on windows, where you'd otherwise have to put 'HEAD@{1}' inside quotes.

Collapse
 
foadlind profile image
foadlind

Yes you are right. I will update the article. Thanks.

Collapse
 
rad_hombre profile image
Matthew Orndoff

Let's go even shorter 🤤

git reset --soft @^