git 最大提交消息大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9733757/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maximum commit message size
提问by Juraj Martinka
采纳答案by Amber
https://github.com/git/git/blob/master/strbuf.hdefines the len
field to be a size_t
. So at the very least, the maximum length has an upper bound at the maximum value of size_t
on your platform of choice.
https://github.com/git/git/blob/master/strbuf.h将该len
字段定义为size_t
. 因此,至少,最大长度的上限为size_t
您选择的平台上的最大值。
回答by huon
Empirically, I think the answer is no. This worked (that's a ~100MB commit message):
根据经验,我认为答案是否定的。这有效(这是一个 ~100MB 的提交消息):
yes | head -c 100000000 | git commit -F - > /dev/null
Command parts explanation:
命令部分说明:
yes
repeats "y\n
" foreverhead -c 100000000
takes only the first 100,000,000 bytes (~100MB)git commit -F -
commits with the passed-in commit message (this won't work if you haven't staged any changes to commit)> /dev/null
hides the output from the command, which includes Git repeating back the very long commit message
yes
\n
永远重复“y ”head -c 100000000
只占用前 100,000,000 字节 (~100MB)git commit -F -
使用传入的提交消息提交(如果您没有提交任何更改,这将不起作用)> /dev/null
隐藏命令的输出,其中包括 Git 重复很长的提交消息
回答by Doug Robinson
Well, actually, there is a limit of ~5MB for JGit.
嗯,实际上,JGit 有大约 5MB 的限制。
Of course, I've got to ask why anyone would do that?! Especially since every subsequent clone would need to include that data. I'd say that if you're going beyond a few KB then you really should be questioning your motives.
当然,我必须问为什么有人会这样做?!特别是因为每个后续克隆都需要包含该数据。我想说的是,如果你超出了几个 KB,那么你真的应该质疑你的动机。