Skip to content

Instantly share code, notes, and snippets.

@tomasfejfar
Last active December 10, 2015 21:08
Show Gist options
  • Save tomasfejfar/4492661 to your computer and use it in GitHub Desktop.
Save tomasfejfar/4492661 to your computer and use it in GitHub Desktop.
Mux SQL files
#!/bin/bash
rm -f ./mux.sql;
rm -f ./tmp.list;
RES=`echo ""`
ITEM=`echo ""`
for file in `git ls-files`
do
HASH=`git rev-list HEAD $file | tail -n 1`
DATE=`git show -s --format="%ct" $HASH --`
ITEM=$(printf "%s %s\n" $DATE $file >> tmp.list)
done
for file in $(cat tmp.list | sort | sed s/"[0-9]* "//)
do
echo $'\n' >> mux.sql;
cat $file >> mux.sql;
done
rm -f ./tmp.list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment