Checkout a specific revision with Git

If you have a project and want to checkout specific revision (commit), you can do it as described below.

1) Clone the project:

$ git clone https://github.com/<organization>/<project>.git
$ cd <project>Code language: HTML, XML (xml)

2) Use the git describe command to get readable name for your commit.
The git describe will first look for a tag which tags exactly that commit. If an exact match was not found, git describe will walk back through the commit history to locate an ancestor commit which has been tagged. The ancestor’s tag will be output along with an abbreviation of the input committish’s SHA1. You can read more about this command here.

$ git describe 5f6ba67e3f8cb59cb9a2f4db22f12e55326a182d
kors-2757-g5f6ba67

3) Checkout the specified revision:

$ git checkout kors-2757-g5f6ba67

4) You can go back to the top with:

$ git checkout master

DevOps / Senior Software Engineer