89

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.

I have tried this:

git log --stat > log.log

But it more or less just gives me very unreadable stuff. What is a command so that I can get a nice formatting on this?

2
  • 1
    What do you want the output to focus on? The commit messages? The branching? The dates? The files? The changes? Commented Apr 8, 2012 at 15:44
  • What do you mean by "very unreadable stuff"? In what way? Commented Nov 25, 2021 at 20:48

3 Answers 3

139

I would recommend using a different format than the default. My usual choice is a summary with the graph, but a one-line summary alone usually does the trick.

Option 1: One-line summary with a graph

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 without a graph

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 documentation here.

Sign up to request clarification or add additional context in comments.

4 Comments

I´m getting Use '--' to separate paths from revisions
One can find the format placeholders at git-scm.com/docs/git-log. Search for sub-heading "pretty formats"
FYI: I know this answer is old but the "docs" link is broken. I'm certainly not going to do what others have done to me: Down vote my answer like 3, 4 or 5+ years later due to the link going bad later in time. I've submitted an edit to point to git-scm.com (git-scm.com/docs/pretty-formats) FYI.
Invalid object name %h
17

Try this line

git log > log.txt

2 Comments

This is the base answer, all I needed.
git log alone will show tags and branches (all branches, including remote branches) on the console. However, git log > log.txt will not have those tag/branch information. I really want to know how to make them the same (i.e. get output with tag/branch infos)
7
git log --oneline --decorate > log.txt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.