git Git日志输出日志文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10063407/
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
Git log output log file
提问by Sebastian
I am doing an assignment in a university course and I am using git as version control for this assignment. The game I have been working on is complete, however, along with the hand in I would like to submit the git log, effectively showing my progress during the time I have been working on it.
我正在大学课程中做一个作业,我正在使用 git 作为这个作业的版本控制。我一直在做的游戏已经完成,但是,我想提交git日志,有效地显示我在工作期间的进度。
I have tried this:
我试过这个:
git log --stat > log.log
But it more or less just gives me very unreadable stuff. Can anyone help me with a command so that I can get a nice formatting on this?
但它或多或少只是给了我非常难以理解的东西。谁能帮我一个命令,以便我可以得到一个很好的格式?
回答by Swift
I would recommend using a different format than the default. My usual choice is summary with the graph, but one line summary alone usually does the trick.
我建议使用与默认格式不同的格式。我通常的选择是用图表进行总结,但单独的一条线总结通常可以解决问题。
Option 1:One line summary w/ Graph
选项 1:带图表的一行摘要
git log --pretty=format:'%h : %s' --graph > log.log
Results in:
结果是:
* 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
Option 2:One line summary w/o Graph
选项 2:没有图表的一行摘要
git log --pretty=format:'%h was %an, %ar, message: %s' > log.log
Results in:
结果是:
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
You can find more formatting options in the docs here
您可以在此处的文档中找到更多格式选项
回答by Mayur
Try this line
试试这条线
git log > log.txt
git log > log.txt
回答by TEDDY
git log --oneline --decorate > log.txt