如何使用https://github.com/clj-jgit/clj-jgit?我正在尝试
(def my-repo (load-repo "."))
(:id (first (git-log my-repo :max-count 1)))
但我不知道如何获取底层对象的字符串。
使用(:id (first (git-log my-repo :max-count 1)))
的代码将返回RevCommit类的实例,该类继承了具有方法.getName((的类AnyObjectId,该方法将返回git提交的哈希。
;; for getting the hash
(.getName (:id (first (git-log my-repo :max-count 1))))
现在,为了获得当前分支名称,在ns-clj-jgit.porcelain命名空间中有另一个函数git-branch-current:
;; for getting the current branch name
(git-branch-current my-repo)