Learn how to revert a commit in Git using both git revert and git reset depending on whether the commit has been pushed or is still local. This quick tutorial covers undoing pushed commits safely with git revert, rolling back local commits with git reset, and understanding the difference between soft, mixed, and hard reset modes. Knowing which command to use in each situation helps you undo mistakes cleanly without disrupting your team's workflow.
📌 WHAT YOU'LL LEARN
Undo a pushed commit safely with 'git revert HEAD'
Target a specific older commit using 'git log --oneline' and 'git revert'
Roll back local commits with 'git reset --soft', default, and '--hard' modes
When to use git revert vs git reset based on push status
🔗 Links
Git revert docs: https://git-scm.com/docs/git-revert
Git reset docs: https://git-scm.com/docs/git-reset
📺 More Git tutorials: • Git Tutorials
✅ Subscribe to QuikTut: / @quiktut
#git #gitcommands #coding #programming