git://git.nikiroo.be
/
fanfix-swing.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
371a36b
)
derename.sh
author
Niki Roo
<niki@nikiroo.be>
Sat, 18 Apr 2020 16:16:18 +0000
(18:16 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Sat, 18 Apr 2020 16:16:18 +0000
(18:16 +0200)
derename.sh
[new file with mode: 0755]
patch
|
blob
diff --git a/derename.sh
b/derename.sh
new file mode 100755
(executable)
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
+