This is an easy way to cd to the root of your project. I found that I frequently was typing things like cd ../../.. after delving into my project and wanting to get back to the root.
Currently, a project root is a directory with a .git/ directory in it or a .this_is_root file, but I’d like to make it more comprehensive soon.
At a command line, run:
$ aYep, that’s it. Just “a”.
In the directory that you want to be identified as a root directory, run:
touch .this_is_rootor create a .this_is_root file in the directory through some other means. Any directory with a .this_is_root file will be considered a root directory even if it lacks a .git/ directory.
Download the root.bash file, and add
source /path/to/root.bashto your .bashrc file.
As I said above, I want to make the definition of a root directory better. I implemented the .this_is_root files to manually set it, but I want to come up with a few more ways to automatically detect a lot of cases. If you have an idea of a good general case, either file an issue or fork it, implement it, and send a pull request.
Speaking of which,
If you have a bug, feature request, suggestion, etc. please file an issue. (Go to the issues tab on the GitHub repo.) Or you can fork it and implement it yourself. Just send a pull request, and I’ll probably be happy to merge it in.
Copyright © Daniel Jackoway 2009
This project is released under the MIT License. See COPYING for the full text.