Skip to content

Instantly share code, notes, and snippets.

@dfelinto
dfelinto / git-migrate.sh
Created November 20, 2013 05:59
Use this in a folder with patches generated with 'git format-patch'. This will strip off the /blender/ folder. Apply them with 'git am' in a fresh branch from the new master.
#!/bin/bash
# migrate git format-patch files from the old gitorious to new git repository
for i in *; do
sed "s/^diff --git a\/blender\/\(.*\) b\/blender\/\(.*\)/diff --git a\/\1 b\/\2/" $i > /tmp/patch;
sed "s/^\([-+][-+][-+]\) \([ab]\)\/blender\/\(.*\)/\1 \2\/\3/" /tmp/patch > $i;
done