Add toroot function to fast changing workdir to repo's root

If we are not in repo, just call `cd` with no arguments (which in most
cases move us to home dir). Maybe will be better to do nothing
otherwise?
This commit is contained in:
Pavel Puchkin 2012-06-22 21:00:40 +11:00
commit e13736091c

View file

@ -60,6 +60,11 @@ function current_repository() {
echo $(git remote -v | cut -d':' -f 2) echo $(git remote -v | cut -d':' -f 2)
} }
# change workdir to repo's root (or do `cd` with no arguments if not in a repo)
function toroot() {
builtin cd "`git_get_root`"
}
# these aliases take advantage of the previous function # these aliases take advantage of the previous function
alias ggpull='git pull origin $(current_branch)' alias ggpull='git pull origin $(current_branch)'
compdef ggpull=git compdef ggpull=git