I'd like to get the number of commits of my Git repository, a bit like SVN revision numbers.
(我想得到我的Git存储库的提交数量,有点像SVN版本号。)
The goal is to use it as a unique, incrementing build number.
(目标是将其用作唯一的递增构建号。)
I currently do like that, on Unix/Cygwin/msysGit:
(我目前在Unix / Cygwin / msysGit上喜欢这样:)
git log --pretty=format:'' | wc -l
But I feel it's a bit of a hack.
(但我觉得这有点像黑客。)
Is there a better way to do that?
(有没有更好的方法呢?)
It would be cool if I actually didn't need wc
or even Git, so it could work on a bare Windows. (如果我实际上不需要wc
甚至Git,那将是很酷的,所以它可以在裸Windows上运行。)
Just read a file or a directory structure... (只需读取文件或目录结构......)
ask by Splo translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…