精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品开源,禁止转载和任何形式的非法内容使用,违者必究
It all started when I decided to figure out why the project I'm working on weighs so much. I've run the following script:这一切都始于我决定弄清楚为什么我正在研究的项目如此重要。我运行以下脚本:
git rev-list --objects --all \ | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \ | sed -n 's/^blob //p' \ | sort --numeric-sort --key=2 \ | cut -c 1-12,41- \ | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
and figured out which commits have the heaviest files. Next, I would like to see who is the author of those commits and when trying to run something like:
并找出哪些提交具有最重的文件。接下来,我想看看谁是这些提交的作者,以及何时尝试运行以下内容:
git show --stat COMMIT_HASH
I get a pile of gobbledegook and when I try rolling back to the commit, I get the abovementioned error.
So my question is: how do I find the author of the commit?我收到一堆gobbledegook,当我尝试回滚到提交时,出现上述错误。
所以我的问题是:我如何找到提交的作者?
Your git show command should work. Either the hash is not valid or the commit object has been corrupted in some way.
Updated: Your script returns object hashes, so probably the reference for that object is invalid somehow.
You wouldn't be able to get the author reference from there anyhow.
This might help, it will list all the commits where the object whose hash you provide has been modified:
您的git show命令应该起作用。哈希无效或提交对象已以某种方式损坏。
更新: 脚本返回对象哈希,因此该对象的引用可能在某种程度上无效。
无论如何,您将无法从那里获得作者参考。
这可能会有所帮助,它将列出所有修改了您提供的哈希值的对象的提交:
git log --find-object=OBJECT_HASH
well I took the hash corresponding to the commit with the heaviest file, the hash was yielded by the bash script. But in that case , is there a simple way to remove the object? – Albert Jan 16 at 21:03好吧,我拿了对应于具有最重文件的提交的哈希,哈希由bash脚本生成。但是在那种情况下,是否有一种简单的方法来删除对象?
but before doing that I would actually like to find out the author of the commit. – Albert Jan 16 at 21:06但在此之前,我实际上想找出提交的作者
ah seems like the hash yielded by the script is not what I thought it was... – Albert Jan 16 at 21:13嗯,似乎脚本产生的哈希值不是我想的那样
I have to update my answer. I ran your command and noticed that it returns object hashes, not commit hashes. – Nick Toumpelis Jan 16 at 21:13我必须更新我的答案。我运行了您的命令,发现它返回对象哈希,而不是提交哈希。