chore(config): add local version of git-root cmd

This commit is contained in:
2025-01-14 06:57:40 +02:00
parent f92c3407f0
commit e1ec501c55

View File

@@ -12,8 +12,19 @@ alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# Get git repository root path
get_git_root()
{
# check that we are in a git repository
if git rev-parse --is-inside-work-tree &> /dev/null; then
git rev-parse --show-toplevel
else
>&2 msgr err "Not in a git repository"
fi
}
# cd to git root directory
alias cdgr='cd "$(git root)"'
alias cdgr='cd "$(get_git_root)"'
# interesting folders, and shortcuts
alias .='cd $HOME'