Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 1.52 KB

README.md

File metadata and controls

58 lines (42 loc) · 1.52 KB

goclone

A enhanced git clone tool, git clone GitHub/GitLab repositories into proper destination.

Example

You can use goclone like one of below:

goclone https://github.com/keaising/goclone
goclone [email protected]:keaising/goclone.git
goclone https://github.com/keaising/goclone.git

And goclone will clone the repo to proper destination by

git clone [email protected]:keaising/goclone.git /path/pre-set/github.com/keaising/goclone

How to pre-set path

git config --global clone.directory /path/pre-set

In a more fluent way

goclone runs in a child process so that it is impossible to cd to the directory where repo is.

But we can seek help from shell.

Please add code below to your shell scripts such as .bash_profile or .zshrc, then reopen shell or terminal.

glone () {
	goclone $1 | tee /tmp/goclone
	cd $(cat /tmp/goclone | head -n 1 | awk '{print $4}')
}

And enjoy a wonderful workflow like:

~/code/github.com
Δ glone [email protected]:keaising/goclone.git
git clone [email protected]:keaising/goclone.git /Users/taiga/code/github.com/keaising/goclone
Cloning into '/Users/taiga/code/github.com/keaising/goclone'...
remote: Enumerating objects: 50, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 50 (delta 19), reused 34 (delta 11), pack-reused 0
Receiving objects: 100% (50/50), 11.92 KiB | 3.97 MiB/s, done.
Resolving deltas: 100% (19/19), done.

~/code/github.com/keaising/goclone master 5s
Δ