From 460aee58a785387dd946afe428523c1a76a5f5a3 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 1 Jun 2025 19:46:05 +0200 Subject: [PATCH] Add cd to git root (cdg) --- fish/.config/fish/conf.d/abbr.fish | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fish/.config/fish/conf.d/abbr.fish b/fish/.config/fish/conf.d/abbr.fish index c77572d..9386d55 100644 --- a/fish/.config/fish/conf.d/abbr.fish +++ b/fish/.config/fish/conf.d/abbr.fish @@ -21,6 +21,14 @@ abbr -a gaa git add -A if type -q "lazygit" abbr -a lg lazygit end +function cdg + set git_root (git rev-parse --show-toplevel 2>/dev/null) + if test -d $git_root + cd $git_root + else + echo "Not inside a Git repository." + end +end # doctrine abbr -a scme sc make:entity