Closed johnyoonh closed 5 years ago
@johnyoonh this is already built into scm_breeze as git_index
. This is aliased to c
(as in c my_git_project
to change project or c --rebuild
to reindex). Here's the section in the README
The command only works for projects that is under a designated directory. I suppose a lot of people will end up in a situation where that is not the case. Even if that was the case, I think being able to go the root git directory without specifying the name will be helpful.
git rev-parse --show-toplevel
is what you're after.
A standard alias for this is.
alias cdgr='cd $(git rev-parse --show-toplevel)'
If this was incorporated into scm_breeze I'd add it as a [1] numbered target for some subset of the commands. Don't know which ones, but I could see this being somewhat useful.
@johnyoonh
variable
project_root
is defined in the code, but it seems to be only use for internal purposes. Would it possible to expose this variable for the users to use, or at least have a command tocd
to project root directory? I usego
personally. It's a simple thing, but I thought other people would find it useful too.