I wrote a little bash alias a while ago to help me instantly to the root directory of a git project from any directory beneath it.
It’s pretty simple. Assume
/projects/foo is the root of a project under git. Assume your pwd is
/projects/foo/bar/baz. At the prompt, typing
git-root will return you to
This works by changing pwd to be the actual
.git directory under the project root, and then backing out of it one level up (to