DEV Community

Cover image for TIL that git can checkout commits, not just branches
Steve Ziegler
Steve Ziegler

Posted on

TIL that git can checkout commits, not just branches

You can pass a commit hash to checkout to quickly see a previous version of code. I like to commit often as I get new chunks of partial code working. If I advance to the point of breaking everything, it's an easy way to see what used to work.

git checkout <commit hash>

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay