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
Unfortunately, changing your current directory can only be done by the shell, not by any subprocess. By the time git gets around to parsing your command, it's already too late -- git has already been spawned in a separate process.
Here's a really gross, untested shell function that just might do what you want:
function git() {
if [ "$1" == "root" ]; then
git-root
else
git "$@"
fi
}