Cyrus 365Academy
cyrus365.com

Β© 2019-2026 Cyrus 365. All rights reserved.

AcademySolutionsContact
Cyrus 365Academy
cyrus365.com
Back to Academy
TutorialBeginner

Undo Your Last Commit in Git πŸ”™

Made a mistake? Learn how to step back safely using Git Reset.

25 Nov 2025Cyrus 3651 min read
GitVersion ControlWorkflow

We've all been there: you typed git commit, hit enter, and immediately realized you forgot a file or made a typo. Don't panic! You can easily undo that commit.

Option 1: The Soft Reset (Safe)

Use this if you want to undo the commit action but keep your file changes. Your work will move back to the 'Staged' area.

bash
git reset --soft HEAD~1

Option 2: The Hard Reset (Destructive)

⚠️ Warning: Use this only if you want to completely destroy the commit and delete all changes in it. There is no going back.

bash
git reset --hard HEAD~1

Summary

  1. 1Use --soft to fix a mistake and commit again.
  2. 2Use --hard to trash the work entirely.
  3. 3HEAD~1 simply means 'go back 1 commit'.

Related articles

TutorialBeginner

Never Forget a Password Again: Intro to Bitwarden πŸ›‘οΈ

Secure your digital life with the best free, open-source password manager. Learn to store, generate, and sync credentials securely.

26 Nov 2025Cyrus 365
TutorialBeginner

Master Remote Access with Bitvise SSH Client πŸ›‘οΈ

Unlock professional-grade server management on Windows. Learn to connect, transfer files, and tunnel securely with Bitvise.

26 Nov 2025Cyrus 365
TutorialBeginner

Unleash the Duck: Managing Cloud Files with Cyberduck πŸ¦†

Ditch the web interface! Learn how to manage FTP, S3, and Google Drive files seamlessly with this free, open-source tool.

26 Nov 2025Cyrus 365

Β© 2019-2026 Cyrus 365. All rights reserved.

AcademySolutionsContact