Checking out a Git commit is a common practice mostly used for troubleshooting purposes.
Step 1. Clone the repository.
git clone https://github.com/<username_or_org>/<repo_name>.git cd <repo_name>
Step 2. List Git commits with:
Step 3. Find the commit you want to checkout from, copy the commit ID (SHA1 hash) and run:
git checkout <commit-SHA1>
Note(s): Once you checked out, the HEAD will point to the commit ID hence leading to the so-called detached HEAD mode.
Step 4. If you want to undo this operation and not save any work done, use:
git switch -
or, checkout another branch. For instance:
git checkout main