Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the 'git describe' information to find a specific commit?

Tags:

git

If I do 'git describe' in my directory I get the output: 1.0-24-g31cdd0f

How does one do a checkout at this same point in the revision tree after it is no longer HEAD? How does one see the log for the 24 commits since the tag?

like image 371
Jeff Avatar asked Apr 29 '15 22:04

Jeff


People also ask

How do I find a specific commit in git?

Looking up changes for a specific commit If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .

How do I reference a specific commit?

To reference a commit, simply write its SHA-hash, and it'll automatically get turned into a link.

How do you describe a commit?

4 : to pledge to do some particular thing When asked if he would volunteer, he wouldn't commit himself.


2 Answers

I disagree with the second part of the answer provided by Greg Hewgill.

Output : 1.0-24-g31cdd0f means that "1.0" is the latest reachable tag and it is 24 commits away from the recent commit "31cdd0f". So, doing git log 31cdd0f.. will not print anything. Because "31cdd0f" is the recent commit and leaving empty after ".." shows all commits till the recent commit.

The correct command should be

git log 1.0..31cdd0f

. This will show all commits between the tag "1.0" and recent commit "31cdd0f".

Sources:

https://schacon.github.io/git/git-describe.html

https://schacon.github.io/git/git-log.html

like image 115
Agry Avatar answered Sep 27 '22 21:09

Agry


The commit that is tagged is the last part without the "g", so 31cdd0f. You can checkout with:

git checkout 31cdd0f

or view the log of commits since the tag 1.0 with

git log 1.0..31cdd0f
like image 36
Greg Hewgill Avatar answered Sep 27 '22 19:09

Greg Hewgill