From 7bfe3af6533f5456f5a032d6f3227c0606638897 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 4 Nov 2014 14:41:51 +0900 Subject: [PATCH] shrc: Add new function root --- shrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shrc b/shrc index b16f74e..5a3cc5f 100755 --- a/shrc +++ b/shrc @@ -433,6 +433,15 @@ cd(){ builtin cd "$@" && pwd } +root(){ + if test "`git rev-parse --is-inside-work-tree 2>/dev/null`" = true + then + cd "`git rev-parse --show-toplevel`" + else + cd / + fi +} + # pad alias pad=notepad __safe_alias pad=gedit