scmbreeze / scm_breeze

Adds numbered shortcuts to the output git status, and much more
https://madebynathan.com/2011/10/19/git-shortcuts-like-youve-never-seen-before/
MIT License
2.82k stars 192 forks source link

Shortcut for cd to project_root? #247

Closed johnyoonh closed 5 years ago

johnyoonh commented 6 years ago

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 to cd to project root directory? I use go personally. It's a simple thing, but I thought other people would find it useful too.

omnikron commented 6 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

johnyoonh commented 6 years ago

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.

HaleTom commented 5 years ago

git rev-parse --show-toplevel is what you're after.

ghthor commented 5 years ago

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