Skip to main content

add an alias for git root

ID
fb1185c
date
2023-07-20 13:10:04+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
0c2ef80
message
add an alias for git root
changed files
2 files, 15 additions

Changed files

git/README.md (3393) → git/README.md (3637)

diff --git a/git/README.md b/git/README.md
index 8f2f38c..33f0bd9 100644
--- a/git/README.md
+++ b/git/README.md
@@ -105,6 +105,15 @@ These scripts are all shortcuts for using [Git], mostly designed to let me do my
   </dd>
 
   <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/git/groot">
+      <code>groot</code>
+    </a>
+  </dt>
+  <dd>
+    alias for <code>git rev-parse --show-toplevel</code>, which prints the root of the current repository
+  </dd>
+
+  <dt>
     <a href="https://github.com/alexwlchan/scripts/blob/main/git/gub">
       <code>gub</code>
     </a>

git/groot (0) → git/groot (82)

diff --git a/git/groot b/git/groot
new file mode 100755
index 0000000..d298352
--- /dev/null
+++ b/git/groot
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+git rev-parse --show-toplevel