Chain several shell commands to get current commit of git folder

Julia has a git library in the stdlibs:

julia> using LibGit2

help?> LibGit2.head
  LibGit2.head(repo::GitRepo) -> GitReference

  Return a GitReference to the current HEAD of repo.

  ────────────────────────────────────────────────────────

  head(pkg::AbstractString) -> String

  Return current HEAD GitHash of the pkg repo as a string.

Also take a look at this:

https://docs.julialang.org/en/stable/stdlib/LibGit2/

2 Likes