Skip to content
👷 [oh-my-zsh plugin] cd dir after git clone if not exist
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
LICENSE
README.md
gitcd.plugin.zsh refactor: code style~ Dec 27, 2018
test.zsh test: add unit test Dec 27, 2018

README.md

gitcd.plugin.zsh

👷 [oh-my-zsh plugin] cd dir after git clone if not exist

Installation

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)

    git clone https://github.com/viko16/gitcd.plugin.zsh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/gitcd
  2. Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):

    plugins=(gitcd)
  3. Start a new terminal session.

Usage

$ gitcd <repo-url>

Example:

$ gitcd https://github.com/viko16/gitcd.plugin.zsh.git
# => will git clone and cd to "~/Code/github.com/viko16/gitcd.plugin.zsh"

If the repository is already cloned to local, it will automatically "cd" there.

Config

By default, gitcd will git clone under ~/Code/<host>/<path>. If you want to change it, just set Environmental Variable name GITCD_HOME.

Example:

$ GITCD_HOME=~/myworkspace/ && gitcd https://github.com/facebook/react
# => ~/myworkspace/github.com/facebook/react

Test

zsh test.zsh

Thanks

License

MIT License © viko16

You can’t perform that action at this time.