Bash script to iterate all commits of a given Git repository and extract all files within each commit.
With a Git repository at /path/to/repository
and an empty directory at /path/to/output
we can run:
./export.sh /path/to/repository /path/to/output
Export 1d9048853b8073e43e43e3250300a82f93d2f431 -> /path/to/output/1d9048853b8073e43e43e3250300a82f93d2f431
Export 5bbaa3bb20b8cb2517b12e9bfb6bc7aef666b9a9 -> /path/to/output/5bbaa3bb20b8cb2517b12e9bfb6bc7aef666b9a9
Export fc56f7e038c272fbdd5e609c508de10056e74278 -> /path/to/output/fc56f7e038c272fbdd5e609c508de10056e74278
Export 75355bae79b22481007e4be13d13a387b7b1df0b -> /path/to/output/75355bae79b22481007e4be13d13a387b7b1df0b
Export d9e4a5742359610028597061babc19d76a937936 -> /path/to/output/d9e4a5742359610028597061babc19d76a937936
Target path /path/to/output
will now contain directories named as each Git commit SHA1.