#!/bin/sh cd ffmpeg ffmpeg_time=$(git log --format="%ct" -n1) cd libswscale git log --format="%H %ct" origin/master | while read hash t do if [ $t -lt $ffmpeg_time ] then git checkout $hash break fi done