How do I export a git log to a text file?

I want to export the log of all commits in a repo to a text file, is there any way to do this?


You'll just need to disable the pager.

git --no-pager log > log.txt

If you want to format it to look nicer, you can use parameters of git log.


Have you tried git log > log.txt ?


git log | clip 

copies to clipboard, then paste to a textfile.

(Especially if you have the problem of line-ending and thus by this method you can copy and paste it in a Microsoft word document(.docx); so there would be a new line for each commit!!!)


You may use the > symbol send the output to a file. For example:

git log > commits.txt

git log --before="2019-2-23" --pretty=format:'"%h","%an","%ae","%aD","%s",' --shortstat --no-merges | paste - - - > log.txt