#TIL 16 - Revert to 1st commit with Git command

Jul 23, 2021 · Dung Huynh

What

Reset repository to its first commit, making all subsequent changes uncommitted.

Why

Clean slate for experiments or starting over while keeping commit history reachable.

How

git update-ref -d HEAD

All commits become unstaged. Recover with git reflog if needed.