# How to get commit hash in Pkg3?

**URL:** https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927
**Category:** General Usage
**Created:** [June 25, 2018, 11:28am UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927 "2018-06-25T11:28:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)
#### Post date: [June 25, 2018, 11:28am UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927/1 "2018-06-25T11:28:35Z")

</div>

With the old package manager, I could go into the package directory and do a `git status` or something similar to find out which commit I was on. How do I do this with Pkg3? While `]st` does print a hash next to each package, I can’t figure out what it is (it doesn’t appear to be the git commit hash). It does also print the package version/tag, but if the package is tracking master then I’m unable to actually figure out which commit its on. Thanks.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [June 25, 2018, 11:32am UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927/2 "2018-06-25T11:32:48Z")

</div>

Packages are not tracked by their commit hash but by their tree hash (which is a content hash, not a “history hash”). This means that the Manifest will still work even if someone rebases their branch.

But a convenience function to get the current commit SHA for the tree SHA is probably a good idea.

---

<div class="post-metadata">

### Author: ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)
#### Post date: [June 25, 2018, 11:37am UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927/3 "2018-06-25T11:37:20Z")

</div>

Thanks, yea I think that would be useful. FWIW, the situation I’m in is that I had done an `add CodeTools#julia-0.7`. A few days later there’s some new commits, so I did `up CodeTools` which did print me this line: `[53a63b46] ~ CodeTools v0.5.0+ #julia-0.7 [https://github.com/JunoLab/CodeTools.jl.git]`, but left wondering whether I had actually gotten those new commits. (checking by hand the contents of the files in the package dir verified that I had, but obviously it’d be nicer to have an easy way to double check git commit).

---

<div class="post-metadata">

### Author: ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)
#### Post date: [June 25, 2018, 4:33pm UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927/4 "2018-06-25T16:33:30Z")

</div>

Might be nice also to have a convenience function that went from Julia commit hash to the Julia version string  
(yes, I know there is a script that does it - but I always have to search to find where it is 😀 )

---

<div class="post-metadata">

### Author: ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)
#### Post date: [October 30, 2019, 7:47pm UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927/5 "2019-10-30T19:47:18Z")

</div>

To go from the SHA hash to a commit, use

```julia
git log --pretty=raw | grep -B 2 <the-SHA-hash>

```
