Skip to content

Instantly share code, notes, and snippets.

View Staz's full-sized avatar

Ben Stasiewicz Staz

View GitHub Profile
@Staz
Staz / extract_file_at_all_revisions.sh
Created March 3, 2022 09:21
Extract file at every git revision
#! /bin/bash
FILE_TO_EXTRACT="$1"
FILENAME="$(basename $FILE_TO_EXTRACT)"
OUTPUT_DIR=$2
[[ ! -d "$OUTPUT_DIR" ]] && mkdir -p "$OUTPUT_DIR"
# List other names this file was known as (in case we want to extract those too)
for FILE_NAME in `git log --follow --name-only --format= -- ${FILE_TO_EXTRACT} | uniq`
do