shell - Export every revision of a single file from a Git repository? -


i have documentation .ai file versioned along project, i'd export every "snapshot" git repository holds file.

any batch/semi-automatic solution?

i have tons of commits, have not intention export them one-by-one.

quick, since no 1 else came something:

mkdir snapshots file=yourfile.ai i=1 commit in $(git log --oneline $file | cut -f 1 -d " ");    git checkout $commit $file;    cp $file snapshots/$i-$commit.ai;    (( = + 1 )) done 

then directory snapshots contains versions of file. names consist of number 1..n increases age of each version , respective commit file extension .ai.

p.s.: don't forget update file after (git checkout head $file) , don't add folder snapshots repository. :)


Comments