From a286f64f40c6c923fcb7d66b6a2272a31a510831 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 18 Apr 2020 18:16:18 +0200 Subject: [PATCH] derename.sh --- derename.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 derename.sh diff --git a/derename.sh b/derename.sh new file mode 100755 index 00000000..6c8cbff0 --- /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 + -- 2.27.0