Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Since it's a binary file, it's not much use for me to look at diffs.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I suggest to write a little script around git log and git show like this:

#!/usr/bin/env bash
DONE=false
FILE="$1"
EXPORTFILE=/tmp/exportfile
git log --pretty=format:"%h" "${FILE}" |until $DONE
do read || DONE=true
  echo "Exporting $FILE as of commit $REPLY to $EXPORTFILE-$REPLY"
  git show $REPLY:"$FILE" > $EXPORTFILE-$REPLY
done

This will export every known committed version of the first argument in the current branch to /tmp/exportfile-12345678.

Why the until, $REPLY and not just while read $commit? You'll miss out on the last line/commit. Read this question on more about that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.