git-cd
v0.2.0
Published
👷 cd dir after git clone if not exist
Downloads
15
Maintainers
Readme
git-cd
👷 cd dir after git clone if not exist
Installation
$ npm i git-cd -g
Usage
$ git-cd <repoUrl>
Set up BASE
directory:
$ git config --global ghq.root THE_PATH_YOU_WANT
By default, the repository is cloned via SSH protocol. Or you can pass --inherit-url
flag to disable it.
Required
motemen/ghq: Remote repository management made easy
go get github.com/motemen/ghq
How it works
- Clone a remote repository under the BASE directory. Just like
git clone
. - Run hook if exists. (Optional)
- Change current directory to cloned repository with the shell.
Hook
Put file in ~/.git-cd/hook.js
, and write anything in nodo.js.
Example:
$ mkdir -p ~/.git-cd
$ echo "console.log('hook receives:', process.argv[2])" > ~/.git-cd/hook.js
Directory Structures
$BASE
├── github.com
│ └── foo
│ └── bar
└── gitlab.com
└── foo
└── bar