Creating a git history out of a collection of tarballs

So, recently I found some projects from 10+ years back that I had a load of tarballs/zip files for which were taking up quite a bit of backup space. I figured I could unzip each of the repositories in date order and put the changes into a git repository in order to save a bit of space. Here are the commands to do this:

Shell

1

2

3

4

5

6

7

8

9

10

11

12

# Put the list of files to import in a file and manually

# edit the order if required to make the history the

# correct order

ls../tarballs/*.bz2&gt;../file_list

git init.

foriin`cat../file_list`;do

rm-fr*;# Clear out for next tarball

tar xjf$i;

git add-A;# Add any new files

git add-u;# Remove any files removed from tarball

git commit-am$i;# Commit with the filename

done

I also did this with some backups from an old psion – converting the 50 or so tarballs to a git repo reduced 500mb of backups to 30mb of git…