Last Updated: February 25, 2016
·
302
· peterejhamilton

Export all user commits for multiple projects

Imagine you have a folder with all your project repos in, and you want to export all the commits you've made to each.

When run in your project directory, the below will go through each project directory, search for commits matching the given author, use oneline formatting and then dump this in a file called my_repo.log in the my_gitlogs directory under whatever path you wish.

find . -maxdepth 1 -type d -exec sh -c '(cd {} && git log --pretty=format:"%h %ad %an %s" --author="Pete Hamilton" --date=short > /PATH/my_gitlogs/${PWD##*/}.log)' ';'

The log format is like this:

71a7f33 2013-09-05 Pete Hamilton Clean up Admin stats endpoints