How do I undo my last comment in Git?
Learn how to use the “git reset” command and reset the HEAD pointer to undo your last commit.
Sometimes developers using Git make a commit with the best of intentions but then later experience regret. In this video, experienced trainer Lorna Mitchell teaches you how to safely undo your newest Git commit and explains when it is appropriate to force push to the repository. Newcomers to Git will learn how to use the “git reset” command and reset their HEAD pointer so that they can continue committing without disrupting the repository.
Continue learning Git in Safari now with our Git Learning Path.
Lorna Mitchell is based in Leeds, UK where she is a Developer Advocate at IBM Cloud Data Services and an experienced developer and trainer. Lorna is the accomplished author of a number of books including PHP Web Services, the Git Workbook, and PHP Master. She brings her technical expertise to audiences all over the world, dispensing guidance on a wide range of technical topics, all with a very practical slant. When she’s not busy spreading knowledge, Lorna blogs at lornajane.net.