summary refs log tree commit diff
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-12-15 10:54:30 -0600
committerStarfall <us@starfall.systems>2022-12-15 10:57:54 -0600
commit8cb1a370f9f99976ccacfa69cb95367879f072c4 (patch)
tree464b3c65f8c8e6f64086563313605c153febbe2d
parent17f706a252c01de2ddbd28809d3b9d789221cf19 (diff)
lsgit: list git repos under the current directory
-rwxr-xr-xlsgit7
1 files changed, 7 insertions, 0 deletions
diff --git a/lsgit b/lsgit
new file mode 100755
index 0000000..9b316ea
--- /dev/null
+++ b/lsgit
@@ -0,0 +1,7 @@
+#!/usr/bin/sh
+# Parse all subdirectories and list git repos encountered.
+# This oneliner just naively looks for .git folders under subdirectories; it won't catch repos with changed --git-dir.
+
+# original source (c) 2016 user1685095 CC BY-SA 3.0 <https://unix.stackexchange.com/a/333918>
+# modified by Alex Starfall 2022
+find '.' -type d -execdir test -e '{}/.git' ';' -printf '%P/\n' -prune | tree --fromfile .