Now Up To  80% OFF  GitKraken Pro
Upgrade to Save
Search
Close this search box.

Git Checkout Commit

Whenever you want to check when a specific behavior was introduced into your code, checking out a commit can be the perfect solution.

We’re going to walk through how to Git checkout a commit using the cross-platform GitKraken Client before showing you how to perform the action in the command line.

Checkout commits with just 2 clicks using GitKraken Client.

How do you Git checkout a commit with GitKraken?

Checking out commits in GitKraken is fast and straightforward. Simply right-click on a commit from the central graph and select Checkout this commit from the context menu.

Yes, it’s that easy.

No commit hashes needed when checking out commits with GitKraken.💥

How do you Git checkout a commit in the command line?

To checkout a Git commit, you will need the commit hash. If you’re using the terminal, you don’t have immediate visual access to your commit information. 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 checkout <commit hash>

Psst: we know you’re in the middle of something important….and you probably just want to get your action done and move on…but bookmark this page for later and check out the incredible autosuggest and autocomplete features in the terminal in GitKraken Client.

Make the process of checking out commits easier with GitKraken Client for Windows, Mac, and Linux. The visual context allows you to checkout commits in just two clicks, without worrying about hashes.

How do you Git checkout a commit with GitLens?

If you have GitLens installed on VS Code, open a repo and then click the Source Control icon on the Activity Bar.

Expand the Commits view and right-click on any commit to access the Switch to Commit action. 

This will effectively checkout the commit in a detached HEAD state, similar to the GitKraken Client and CLI options above.  

Alternatively, there’s a helpful GitLens feature that can help you browse the repository at any point as a virtual folder. Right-click on any commit in the commits view, but this time click on the Browse submenu.

This will allow you to open up a new VS Code window from the specified point in time, without formally checking out a branch or commit.

If you want to checkout this feature for yourself, jump into VS Code for Web and install GitLens to give this a go! 

GitLens can help you stay organized and on track with your tasks and projects.  Unlock the full power of Git in VS Code for free!

Install GitLens for VS Code

Additional Resources

Table of Contents

Visual Studio Code is required to install GitLens.

Don’t have Visual Studio Code? Get it now.

Team Collaboration Services

Secure cloud-backed services that span across all products in the DevEx platform to keep your workflows connected across projects, repos, and team members
Launchpad – All your PRs, issues, & tasks in one spot to kick off a focused, unblocked day. Code Suggest – Real code suggestions anywhere in your project, as simple as in Google Docs. Cloud Patches – Speed up PR reviews by enabling early collaboration on work-in-progress. Workspaces – Group & sync repos to simplify multi-repo actions, & get new devs coding faster. DORA Insights – Data-driven code insights to track & improve development velocity. Security & Admin – Easily set up SSO, manage access, & streamline IdP integrations.
winget install gitkraken.cli