Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .