文件的提交次数

时间:2013-01-21 07:30:10

标签: git

如何计算修改文件的所有提交?这不必包括移动/重命名,但如果确实如此,那就没问题了。

2 个答案:

答案 0 :(得分:4)

git log --oneline -- path/to/file | wc -l

答案 1 :(得分:0)

在日志文件或HEAD文件中,每次看到提交时,都会添加“commit:”

等;我在这里有3次提交,

60b09150ac190a26de5ae185046bf518ad35e6f8 eaee963404432be926c6e9bc77d40be3d9e9ed65 burak <burak@192.168.5.222> 1353615257 -0500  commit: I added batch loader method for the emages This method helps me load a bunch of images and ensure they are       * fully loaded when we want to use them.       imageFile The path and name of the image file to load.      *   tracker This will help ensure all the images are loaded.      *    id A unique identifier for each image in the tracker. It      * will only wait for ids it knows about.      *   A constructed image that has been registered with the tracker.      * Note that the image's data has not necessarily been fully loaded when       * this method ends.
    eaee963404432be926c6e9bc77d40be3d9e9ed65 0499e1e64cc904591020e2c79dcd64827b1015ba burak <burak@burak-THINK> 1353808160 -0500    commit: AnimatedSpriteViewer added open sprite feature by chosing a file from file choser, after user picks up the file, user should be able to load the entire state and name of the pose. Tested and fully functionally works
    0499e1e64cc904591020e2c79dcd64827b1015ba 181bc7ab293a8710cb14664433043a4ebbe4b377 burak <burak@129.49.192.56> 1354006011 -0500  commit: Ideally, the hash function should map each possible key to a unique slot index, but this ideal is rarely achievable in practice (unless the hash keys are fixed; i.e. new entries are never added to the table after it is created). Instead, most hash table designs assume that hash collisions—different keys that map to the same hash value—will occur and must be accommodated in some way.

所以在HEAD文件或日志文件中,您可以打印并搜索commit:word;

的数量
cat git.log | grep commit: > number_of_line.txt

然后在文件中计算提交次数:

wc -ls number_of_lines.txt