Mercurial has a way of printing the root directory (that contains .hg) via
hg root
Is there something equivalent in git to get the director
To write a simple answer here, so that we can use
git root
to do the job, simply configure your git by using
git config --global alias.root "rev-parse --show-toplevel"
and then you might want to add the following to your ~/.bashrc:
alias cdroot='cd $(git root)'
so that you can just use cdroot to go to the top of your repo.