diff options
author | Jesse Luehrs <doy@tozt.net> | 2017-10-29 19:21:37 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2017-10-29 19:29:40 -0400 |
commit | 03b67580350ad2fa7842066938af918fd6a638f0 (patch) | |
tree | de183d3efc4449a137d7f7fd659b83c6749daf25 | |
parent | 8d16bf64b3fe328a38a7674de88d6d20c278976d (diff) | |
download | conf-03b67580350ad2fa7842066938af918fd6a638f0.tar.gz conf-03b67580350ad2fa7842066938af918fd6a638f0.zip |
add a function to cd to the root of the git repository
-rw-r--r-- | functions | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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: |