0

如何获得修改文件的所有提交的计数?这不必包括移动/重命名,但如果是这样就可以了。

4

2 回答 2

4

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

于 2013-01-21T07:38:35.963 回答
0

在日志文件或 HEAD 文件中,每次看到 commit 时,都会添加“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 文件或日志文件中,可以打印和搜索 number of commit: word;

cat git.log | grep commit: > number_of_line.txt

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

wc -ls number_of_lines.txt
于 2013-01-21T07:46:08.493 回答