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

后端 未结 10 1526
醉酒成梦
醉酒成梦 2020-12-07 12:11

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

10条回答
  •  囚心锁ツ
    2020-12-07 12:44

    Its been long since this question was asked and by that time things have been evolved.

    But, it is very interesting that all answers here are correct but not really addressing a post command error which is also very common. Lets try to understand . . . .

    Who knew it was super easy. Run a simple command

    git log -p --all > git_log.txt
    

    but then I strucked on an error

    > warning: inexact rename detection was skipped due to too many files.
    > warning: you may want to set your diff.renameLimit variable to at least 2951 and retry the command.
    

    and we had a problem. The output file was half a gig.

    We just wanted the first half of 2018 which we are able to do with --after and --until

    git log --pretty=format:"%ad - %an: %s" --after="2018-01-01" --until="2018-06-30" > git_log.txt
    

    This worked nicely for our purposes and was nice to know that we could change the format if need be.

提交回复
热议问题