- Add 'wbtdev/zsh-gitcd' to your plugin manager.
$ gitcd <repo-url> (optional <branch>)
Example:
$ gitcd https://github.com/wbtdev/zsh-gitcd.git
# => will git clone and cd to "~/src/github.com/wbtdev/zsh-gitcd"
If the repository exists locally, it will automatically "cd" into it, and if you provided a branch name, it will check it out.
By default, gitcd
will git clone under ~/src/<host>/<path>
.
Change the environmental variable GITCD_HOME
if you want it somewhere else.
Example:
$ gitcd [email protected]:zsh-users/zsh.git zsh
# => ~/src/github.com/zsh-users/zsh on the zsh branch.