summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-10-29 19:21:37 -0400
committerJesse Luehrs <doy@tozt.net>2017-10-29 19:29:40 -0400
commit03b67580350ad2fa7842066938af918fd6a638f0 (patch)
treede183d3efc4449a137d7f7fd659b83c6749daf25
parent8d16bf64b3fe328a38a7674de88d6d20c278976d (diff)
downloadconf-03b67580350ad2fa7842066938af918fd6a638f0.tar.gz
conf-03b67580350ad2fa7842066938af918fd6a638f0.zip
add a function to cd to the root of the git repository
-rw-r--r--functions10
1 files changed, 10 insertions, 0 deletions
diff --git a/functions b/functions
index 5622940..d6068e0 100644
--- a/functions
+++ b/functions
@@ -7,4 +7,14 @@ function perldoc {
fi
}
+function cdu {
+ local root
+ root="$(git rev-parse --show-superproject-working-tree 2>/dev/null)"
+ if [ -n "$root" ]; then
+ cd "$root"
+ else
+ cd "$(git rev-parse --show-toplevel)"
+ fi
+}
+
# vim:ft=sh: