Reputation: 151
I cloned a git repository yesterday and am using it in Ubuntu. I need to find the version of that cloned repository I am using. What is the command for that?
Upvotes: 3
Views: 33145
Reputation: 44422
Maybe git describe
would be helpful for what you want to do?
See for more information the official documentation here.
git describe --long // outputs for example: v1.0.4-14-g2414721
As you can read in the documentation the --long
argument will do the following:
Always output the long format (the tag, the number of commits and the abbreviated commit name) even when it matches a tag.
So in the example output above the latest tagged version is v1.0.4
; there are 14
commits on top and commit hash is g2414721
.
Upvotes: 0
Reputation: 390
You can use the more common git log -1
or the less used git rev-parse HEAD
Upvotes: 6
Reputation: 1329762
If you have not pushed yes, you can check the version of origin/master
, or of FETCH_HEAD
(see FETCH_HEAD
)
cd /path/to/your/local/cloned/repo
git rev-parse origin/master
git rev-parse FETCH_HEAD
That will give you the commit ID (SHA1) of what was last fetched.
Upvotes: 1