A enhanced git clone tool, git clone
GitHub/GitLab repositories into proper destination.
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
git config --global clone.directory /path/pre-set
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
Δ