gh
allows you to very quickly navigate between GitHub project cloned on your
local box. It will cd
into project directories quickly and clone repos that do
not exist.
There is a lot of mental overhead trying to manage a custom ~/src
directory with your projects. I tried managing by work/personal, programming language, even tried a different directory for each month. I found by simply making your projects path reflect GitHub, it was much easier to remember where things were.
Here is a demo of me moving around various projects
Clone and/or go to ~/src/github.com/githubuser/githubrepo
.
gh githubuser githubrepo
It'll either just be a cd
or it will clone [email protected]:githubuser/githubrepo.git
Note that tab completion is available for project and usernames.
gh
will clone or cd
into $GH_BASE_DIR/github.com/user/repo
.
By default $GH_BASE_DIR
points to $HOME/src
. By changing the $GH_BASE_DIR
variable in your shell's config file, you can control where gh
will clone/cd
into.
Note: Already cloned repos will not be transferred to the new location, they will be cloned again.
TBD