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 git@github.com:keaising/goclone.git
goclone https://github.com/keaising/goclone.git
And goclone
will clone the repo to proper destination by
git clone git@github.com: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 git@github.com:keaising/goclone.git
git clone git@github.com: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
Δ