簡體   English   中英

Git 日志 output 日志文件

[英]Git log output log file

我在大學課程中做作業,我使用 Git 作為此作業的版本控制。 我一直在做的游戲已經完成了。 但是,隨着提交,我想提交 Git 日志,有效地顯示我在處理它期間的進度。

我試過這個:

git log --stat > log.log

但它或多或少只是給了我非常難以理解的東西。 什么命令可以讓我得到一個很好的格式?

我建議使用與默認格式不同的格式。 我通常的選擇是帶有圖表的摘要,但僅一行摘要通常就可以解決問題。

選項 1:帶圖表的單行摘要

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

您可以在此處的文檔中找到更多格式化選項。

試試這條線

git log > log.txt

git log --oneline --decorate > log.txt

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM