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?

  • In Git, I get an error when I try to delete my local branch
  • Using Visual Studio 2012's built-in merge tool with Git
  • Merge or Rebase? How to best keep develop branch in synch with master
  • GIT clone over http fails (curl result = 22, http_code 401)
  • How did my collaborators' commits find their way into my branch?
  • Subgit installation on TFS Maintained Git repo
  • jenkins Wipe out repository and force clone vs Clean before checkout
  • Shallow clone followed by shallow pull
  • Android Studio Terminal crashes on git commit
  • Permission denied although I can do whoami
  • Obtain a git repository's tree elsewhere via --work-tree while keeping --git-dir repository unmodified
  • Making changes to a git tag and repushing
  • 4 Solutions collect form web for “How do I export a git log to a text file?”

    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

    You can make log report more clearly, by

    (1) setting number of latest commits (for example, in below command, we get latest 50 commits, you can change it to 100, 500, etc.)

    (2) display long commit in one line
    This command is display commit log in current branch:

     git log --oneline -50 > log50_latest_commits.txt

    (3) If you want display commit at all branch

     git log --all --oneline -50 > log50_latest_commits.txt

    Generated text file will stand at the current directory.


    (tested on git version and it works on many other versions of Git)

    Git Baby is a git and github fan, let's start git clone.