Jeannot Muller
jeannot-muller.com

Follow

jeannot-muller.com

Follow
Format Git Logs

Format Git Logs

Jeannot Muller's photo
Jeannot Muller
·May 3, 2021·

1 min read

Play this article

I have to build a list box for one customer app showing the version history of their app. The easiest way is obviously to first upload the git log into a database, but the standard log looks like this:

Command: Output:

Beautiful, but not what I needed. I wanted a CSV format for easy upload to my database and obviously, the date should be in SQL format.

The following code will help you with this. Just run it in the root folder of your GIT-enabled project in a terminal window on your macOS.

git log --pretty=format:'%ad;%s' --date=format:'%Y-%m-%d %H:%M:%S' > YOURPATH/myGitLog.txt

This will provide me with the desired output for an easy upload to a database and to go from there.

 
Share this