我想从git仓库解析metainformations。 我想为提交获取单个信息,例如
git log --pretty=format:%an HEAD^..HEAD问题是,这不适用于存储库中的第一次提交。
git show --pretty=format:%an HEAD^..HEAD也接近我想要的,除了我不感兴趣解析实际差异。
任何想法如何使git日志工作的第一次提交或如何禁用显示提交内容的git显示?
或者,有没有更好的方法来检索给定提交的元数据?
I'd like to parse meta information from git repository. I'd like to fetch a single information for a commit, as in
git log --pretty=format:%an HEAD^..HEADProblem is, this is not working for the first commit in repository.
git show --pretty=format:%an HEAD^..HEADis also close to what I want, except I'm not interested in parsing actual diff.
Any idea how to make git log work for the first commit or how to disable git show from showing commit content?
Or, is there any better way how to retrieve metadata about given commit?
最满意答案
提供安静选项以显示抑制差异。
git show --quiet HEAD所以对于你的例子,作者姓名:
git show --quiet --pretty=format:%anSupply the quiet option to show to suppress the diff.
git show --quiet HEADSo for your example, author name:
git show --quiet --pretty=format:%an更多推荐
发布评论