zsh/git: add alias to go back to root dir

This commit is contained in:
Mathieu Maret 2023-06-21 15:15:58 +02:00
parent 3a5bbecd6c
commit 11fda8a235
2 changed files with 7 additions and 0 deletions

View File

@ -70,6 +70,7 @@
up = pull --rebase --autostash
rebaseour = "rebase -Xours"
rank = "shortlog -s -n --no-merges"
root = rev-parse --show-toplevel
[rebase]
# when rebasing, update the other common branch too.
# See https://andrewlock.net/working-with-stacked-branches-in-git-is-easier-with-update-refs/

View File

@ -65,3 +65,9 @@ alias -g S='&> /dev/null &'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias senv='source ~/venv/bin/activate'
alias r='if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) != 'true' ]]; then
>&2 echo "Not a git repository"
return 1
else
cd $(git root)
fi'