+bin/vi-git-both-modified
authorJan Kratochvil <jan@jankratochvil.net>
Fri, 10 Nov 2023 14:47:23 +0000 (22:47 +0800)
committerJan Kratochvil <jan@jankratochvil.net>
Fri, 10 Nov 2023 14:47:23 +0000 (22:47 +0800)
bin/vi-git-both-modified [new file with mode: 0755]

diff --git a/bin/vi-git-both-modified b/bin/vi-git-both-modified
new file mode 100755 (executable)
index 0000000..8f47892
--- /dev/null
@@ -0,0 +1,15 @@
+#! /bin/bash
+fis=""
+for fi in $(git status|sed -n 's/^     both modified: *//p');do
+  if ! grep -q '^<<<<<<< ' $fi;then
+    git add $fi
+    continue
+  fi
+  fis="$fis $fi"
+done
+if [ -z "$fis" ];then
+  echo done
+  exit 0
+fi
+set -x
+exec vim $fis