By checking out to one of the commits in the history you are moving your git into so called 'detached state', which looks like is not what you want. Use this single command to create a new branch on one of the commits from the history:

git checkout -b <new_branch_name> <SHA1>
Answer from Andrejs Cainikovs on Stack Overflow
🌐
DevOps Cube
devopscube.com › checkout-clone-specific-git-commit-id-sha
How to Checkout/Clone From a Specific Git Commit Id (SHA)
March 14, 2025 - Step 3: Copy the commit (SHA) id and checkout using the following command. git checkout 28cd74decb47d8a5294eb59e793cb24a0f242e9e
Discussions

How do we understand the command: "git checkout commit_id ." - Stack Overflow
I understand that git checkout commit_id will move the head to the commit_id and I will get an detached head and my working space will be overwritten by the commit_id. Today I found another git ch... More on stackoverflow.com
🌐 stackoverflow.com
How to switch to specific git commit?
Terminal git checkout Or use the extension "git graph" which you seem to have installed (icon left of refresh), find the commit right click and select "checkout..." More on reddit.com
🌐 r/vscode
5
2
January 21, 2024
git checkout with commit ID? - Stack Overflow
I'm a git newbie, I've cloned the repository and I've been given a git commit ID. When I try to do: $ git checkout 2ae0568 I get: error: pathspec '2ae0568' did not match any file(s) known to git ... More on stackoverflow.com
🌐 stackoverflow.com
Is this the way to checkout a repo to a specific commit?
Sure, that works, and it creates a new branch called "bar", but you don't even need to make a branch. You can just git checkout if you only want to look at it. You can even commit changes, but you'll be working on a detached head. If you later want to turn that into a branch, you can. More on reddit.com
🌐 r/git
4
1
January 22, 2021
People also ask

Can I push changes from a specific commit checkout?
Yes, but only if you create a branch from that commit. Otherwise, the changes are in a detached HEAD state and can’t be pushed.
🌐
linuxbuz.com
linuxbuz.com › devops › checkout-clone-specific-git-commit-id-sha
How to Checkout/Clone a Git Repository from a Specific Commit ID ...
Can I make changes after checking out a specific commit?
Yes, you can make changes and commit them, but these commits will not belong to any branch unless you create a new branch.
🌐
linuxbuz.com
linuxbuz.com › devops › checkout-clone-specific-git-commit-id-sha
How to Checkout/Clone a Git Repository from a Specific Commit ID ...
What does 'git reset --hard' do?
This command resets the working directory and the index to match a specific commit. Be cautious, any uncommitted changes will be lost.
🌐
linuxbuz.com
linuxbuz.com › devops › checkout-clone-specific-git-commit-id-sha
How to Checkout/Clone a Git Repository from a Specific Commit ID ...
🌐
Medium
medium.com › @gecno › mastering-git-exploring-git-checkout-commit-id-path-4d11ba2a597d
Mastering Git: Exploring git checkout <commit id> <path> | by Gec | Medium
January 17, 2024 - In conclusion, git checkout <commit id> <path> is a valuable command for navigating the history of your project and managing individual file versions. Whether you're inspecting changes, recovering lost modifications, or experimenting with different ...
🌐
Git
git-scm.com › docs › git-checkout
Git - git-checkout Documentation
The same as git checkout <branch>, except that instead of pointing HEAD at the branch, it points HEAD at the commit ID.
🌐
GitKraken
gitkraken.com › home › learn › problems & solutions › git checkout commit
How do you Git checkout a commit? | Solutions to Git Problems
November 30, 2022 - To pull up a list of your commits and their associated hashes, you can run the git log command. To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.
🌐
Git Tower
git-tower.com › learn › git faq › how to checkout a commit in git
How to Checkout a Commit in Git | Learn Version Control with Git
1 week ago - With the git switch command (or, alternatively, the git checkout command), you can simply provide the name of the branch you want to checkout. This branch will then be your current working branch, also referred to as "HEAD" in Git. Any new commits you make from this point on (until you switch branches again) will be recorded in this branch's context.
Find elsewhere
🌐
iO Flood
ioflood.com › blog › git-checkout-commit-how-to-a-retrieve-a-specific-previous-commit
Git Checkout Commit | How to retrieve a specific previous commit
November 8, 2023 - With preparations done, let’s delve into the process of git checkout a specific commit. The first step is to get the commit ID, also known as the SHA. This can be found in your local repository or on platforms like Github.
🌐
LinuxBuz
linuxbuz.com › devops › checkout-clone-specific-git-commit-id-sha
How to Checkout/Clone a Git Repository from a Specific Commit ID (SHA) - LinuxBuz
September 15, 2024 - To check out a specific commit in Git, you use the git checkout command with the commit hash (SHA). Below is a step-by-step guide on how to do it: 1. Open your terminal and navigate to the directory of your repository: ... commit a1b2c3d4e5...
🌐
Medium
medium.com › @Ariobarxan › checking-out-a-commit-in-git-533fe702cf23
Checking out a commit in Git. This article is one of the articles in… | by Ario Liyan | Medium
September 20, 2023 - To check out a specific commit in Git, you can use the git checkout command followed by the commit reference.
🌐
Unfuddle
unfuddle.com › stack › tips-tricks › git-pull-specific-commit
Unfuddle Support | Git - Pull Specific Commit
# make sure you fetch from the origin first $ git fetch origin # view code at COMMIT_ID (abc123) $ git checkout abc123 # bring only COMMIT_ID (abc123) # to your branch # assuming your branch is master $ git checkout master $ git cherry-pick abc123 # bring all changes up to # COMMIT_ID (abc123) to your branch # assuming your branch is master $ git checkout master $ git merge abc123
🌐
AskPython
askpython.com › home › step-by-step guide to checking out a commit id with gitpython
Step-by-Step Guide to Checking Out a Commit ID with GitPython - AskPython
April 10, 2025 - Add the commit_id you want to check in your repository. If GitPython can check that commit ID, it will print the message “Checkout successful’. Else it will print the error message as.
🌐
Linux Hint
linuxhint.com › checkout-specific-commit-git
How to Checkout a Specific Commit in Git? – Linux Hint
To checkout a specific commit, ensure you have the repository cloned to your local machine. To illustrate example, let’s use a repository that contains “Hello world” in all languages. ... To checkout the specific commit, we need the SHA1 identifier as shown in the git log command.
🌐
Graph AI
graphapp.ai › engineering-glossary › git › commit-id
commit ID: Definition, Examples, and Applications | Graph AI
These examples will illustrate the practical applications of the commit ID and provide a better understanding of its role in Git. Suppose a developer wants to check out a specific commit. They would use the 'git checkout' command followed by the commit ID, like so: 'git checkout d3adb33f'.
🌐
Reddit
reddit.com › r/vscode › how to switch to specific git commit?
r/vscode on Reddit: How to switch to specific git commit?
January 21, 2024 -

Hi, i want to inspect the old version of my code. I need to see the list of commits and chose the one, i want to switch to.

I can't achieve this with default source control tool in VS code. Seems like I'm only able to switch to the latest commit of specified branch> When i press bottom left corner "branch selector", i see only branches and not commits:

branch selector in vsCode

I was able to achieve this by using gitLens plugin, but it is overkill, requires gitkraken and other stuff and not free. Here is the list of commits and i can choose commit to which i need to switch:

gitLens list of commits

Is there any way to achieve this without extensions?

Is there any minimal extensions for this?

🌐
LabEx
labex.io › tutorials › git-how-to-checkout-specific-git-commit-462656
How to checkout specific git commit | LabEx
gitGraph commit id: "Initial Commit" commit id: "Add README" branch feature commit id: "Implement login" checkout main merge feature id: "Merge login feature"
🌐
GitKraken
gitkraken.com › home › learn › git checkout
Git Checkout - Checkout Branches, Commits, & Tags | Learn Git
March 26, 2026 - Learn how to Git checkout a remote branch, how to checkout a commit, and how to checkout a tag, and understand what Git detached HEAD state means.
🌐
Cloud Infrastructure Services
cloudinfrastructureservices.co.uk › home › blog › how to clone a specific commit in git? (tutorial example)
How to Clone a Specific Commit in Git? (Tutorial Example)
December 2, 2022 - ... Step 2 – Once the repository ... output: Step 4 – To clone or checkout from the specific commit, you will need the SHA1 identifier ......