web-dev-qa-db-ja.com

Gitログ出力ログファイル

私は大学のコースで課題を行っており、この課題のバージョン管理としてgitを使用しています。私が取り組んでいるゲームは完了していますが、手とともにgitログを提出して、作業中の進捗状況を効果的に示したいと思います。

私はこれを試しました:

git log --stat > log.log

しかし、多かれ少なかれ、非常に読みにくいものを与えてくれます。誰もがコマンドで私を助けて、これで素敵なフォーマットを取得できますか?

65
Sebastian

デフォルトとは異なる形式を使用することをお勧めします。私の通常の選択はグラフでの要約ですが、通常は1行の要約だけでうまくいきます。

オプション1:グラフ付きの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:グラフなしの1行の要約

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

109
Swift

この行を試してください

git log > log.txt

7
Mayur
git log --oneline --decorate > log.txt
2
TEDDY