Git日志输出日志文件

时间:2012-04-08 14:07:54

标签: git logging

我正在大学课程中完成作业,我正在使用git作为此作业的版本控制。我一直在努力的游戏是完整的,但是,随着我的提交,我想提交git日志,有效地展示了我在工作期间的进展。

我试过这个:

git log --stat > log.log

但它或多或少只是给了我非常难以理解的东西。任何人都可以帮我一个命令,以便我可以得到一个很好的格式吗?

3 个答案:

答案 0 :(得分:103)

我建议使用与默认格式不同的格式。我通常的选择是图表的摘要,但单独的一行摘要通常可以解决问题。

选项1:一行摘要w / Graph

git log --pretty=format:'%h : %s' --graph > log.log

结果:

* 2d3acf9 : ignore errors from SIGCHLD on trap
*   5e3ee11 : Merge branch 'master' of git://github.com/dustin/grit
|\  
| * 420eac9 : Added a method for getting the current branch.
* | 30e367c : timeout code and tests
* | 5a09431 : add timeout protection to grit
* | e1193f8 : support for heads with slashes in them
|/  
* d6016bc : require time for xmlschema

选项2:一行摘要没有图表

git log --pretty=format:'%h was %an, %ar, message: %s' > log.log

结果:

a6b444f was Scott Chacon, 5 days ago, message: dammit, this is the second time this has re
49d77f7 was Scott Chacon, 8 days ago, message: modified index to create refs/heads if it i
9764edd was Hans Engel, 11 days ago, message: Add diff-lcs dependency
e1ba1e3 was Hans Engel, 11 days ago, message: Add dependency for Open4
0f87b4d was Scott Chacon, 12 days ago, message: merged recent changes

您可以在文档here

中找到更多格式选项

答案 1 :(得分:7)

试试这一行

git log > log.txt

答案 2 :(得分:2)

git log --oneline --decorate > log.txt
相关问题