From: Niki Roo Date: Sat, 18 Apr 2020 16:16:18 +0000 (+0200) Subject: derename.sh X-Git-Tag: fanfix-3.1.1~3^2 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=a286f64f40c6c923fcb7d66b6a2272a31a510831;p=fanfix.git derename.sh --- diff --git a/derename.sh b/derename.sh new file mode 100755 index 0000000..6c8cbff --- /dev/null +++ b/derename.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +git status | grep renamed: | sed 's/[^:]*: *\([^>]*\) -> \(.*\)/\1>\2/g' | while read -r ln; do + old="`echo "$ln" | cut -f1 -d'>'`" + new="`echo "$ln" | cut -f2 -d'>'`" + mkdir -p "`dirname "$old"`" + git mv "$new" "$old" + rmdir "`dirname "$new"`" 2>/dev/null + true +done +