https://github.com/viko16/git-cd
👷 git clone ⇒ run hooks (optional) ⇒ cd
https://github.com/viko16/git-cd
cli git repository-management
Last synced: 2 months ago
JSON representation
👷 git clone ⇒ run hooks (optional) ⇒ cd
- Host: GitHub
- URL: https://github.com/viko16/git-cd
- Owner: viko16
- Created: 2018-06-11T03:04:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-07T02:02:59.000Z (almost 8 years ago)
- Last Synced: 2024-05-13T16:24:23.061Z (about 2 years ago)
- Topics: cli, git, repository-management
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# git-cd
[](https://travis-ci.org/viko16/git-cd)
[](https://npmjs.org/package/git-cd)
[](http://standardjs.com/)
> 👷 cd dir after git clone if not exist
## Installation
``` sh
$ npm i git-cd -g
```
## Usage
``` sh
$ git-cd
```
Set up `BASE` directory:
```sh
$ 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](https://github.com/motemen/ghq): Remote repository management made easy
```sh
go get github.com/motemen/ghq
```
## How it works
1. Clone a remote repository under the BASE directory. Just like `git clone`.
2. Run hook if exists. (Optional)
3. Change current directory to cloned repository with the shell.
## Hook
Put file in `~/.git-cd/hook.js` , and write anything in nodo.js.
Example:
``` sh
$ 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
```
## License
[MIT License](https://opensource.org/licenses/MIT) © [viko16](https://github.com/viko16)