
Git & GitHub Notes - Part 3: Undoing Changes & Forking
Undoing Changes git reset This command allows you to move the HEAD (current commit pointer) to a previous commit. git log Before undoing commits, it’s useful to see the commit history . Example Output: commit d00cb3c91f942a4aa10c3d14e2428344e670e9d5 (HEAD -> testing-lang ) Author: Kervie Jay <166139157+kervieszn14@users.noreply.github.com> Date: Fri Mar 6 09:23:19 2026 +0800 Update README.md commit 896d60f6a6f5f695da06349bed40f530bf083413 Author: Kervie Jay <166139157+kervieszn14@users.noreply.github.com> Date: Fri Mar 6 09:21:59 2026 +0800 README.md commit 389969f59a98fe3496660f59a301f8ded48a74fb Author: Kervie Jay <166139157+kervieszn14@users.noreply.github.com> Date: Fri Mar 6 09:20:26 2026 +0800 Each commit has a unique commit hash which can be used to reset to a specific commit. git reset HEAD~1 This command moves the repository one commit back . Meaning: HEAD - current commit ~1 - one commit before the current commit This removes the latest commit but keeps the changes in working
Continue reading on Dev.to Tutorial
Opens in a new tab

