Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT checking out code from output of "git describe"

I am thinking about using git describe to generate automated version numbers. As suggest here.

My question is that if I get o/p of git describe as v2.0-64-g835c907, how can I checkout that particular revision number using git in future?

like image 250
Vivek Goel Avatar asked Aug 06 '12 19:08

Vivek Goel


People also ask

What is the git command for checking out a file from a repository?

Solution 1: Use the git checkout command 1. Checkout to the branch where you want to copy the file. 2. Once you are on the correct branch, copy the file.

Which is correct about git checkout?

In Git, the term checkout is used for the act of switching between different versions of a target entity. The git checkout command is used to switch between branches in a repository. Be careful with your staged files and commits when switching between branches.

How do I checkout a specific commit in git?

To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.


2 Answers

You can just do

git checkout v2.0-64-g835c907

The output from git describe can be used as a reference to a commit itself

like image 184
D-Rock Avatar answered Sep 19 '22 13:09

D-Rock


If I understand correctly this may be what you want:

git checkout `git describe`
like image 31
iltempo Avatar answered Sep 20 '22 13:09

iltempo