I wanted a simple git command to go up to the \"root\" of the repository.
I started with a script, but figured that I cannot change active directory of the shell, I
Peter's answer above works great if you're in a subdirectory of the git root. If you're already in the git root, it'll throw you back to $HOME. To prevent this, we can use some bash conditionals.
if [ "`git rev-parse --show-cdup`" != "" ]; then cd `git rev-parse --show-cdup`; fi
so the alias becomes:
alias git-root='if [ "`git rev-parse --show-cdup`" != "" ]; then cd `git rev-parse --show-cdup`; fi'