mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-16 17:05:11 +00:00
chore(config): add local version of git-root cmd
This commit is contained in:
13
config/alias
13
config/alias
@@ -12,8 +12,19 @@ alias ..="cd .."
|
|||||||
alias ...="cd ../.."
|
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
|
# cd to git root directory
|
||||||
alias cdgr='cd "$(git root)"'
|
alias cdgr='cd "$(get_git_root)"'
|
||||||
|
|
||||||
# interesting folders, and shortcuts
|
# interesting folders, and shortcuts
|
||||||
alias .='cd $HOME'
|
alias .='cd $HOME'
|
||||||
|
|||||||
Reference in New Issue
Block a user