feat: Implement git-get command#1045
Conversation
f38650e to
20631d5
Compare
|
|
||
| ## EXAMPLES | ||
|
|
||
| $ GIT_EXTRA_DEFAULT_CLONE_PATH="$HOME/some-dir" git-get 'https://github.com/hyperupcall/bake' |
There was a problem hiding this comment.
It seems that this feature is not much convenient than git clone 'https://github.com/hyperupcall/bake' $GIT_EXTRA_DEFAULT_CLONE_PATH/bake. Could you provide some real-world use cases for this tool?
There was a problem hiding this comment.
The linked issue did suggest making a PR, but this change additionally significantly reduces typing.
On some keyboards (like mine), the ~ is either touch to reach, or requires an extra button (Fn+Shift for some 80%s). $HOME is also quite long to type. Besides that, this is a good solution when cloning frequently. It's common to clone repositories (maybe for just sifting through or quickly reading code) to a certain directory, such as ~/Programming/git. I myself have about 50 Git repositories cloned there. Having an actual variable like $GIT_CLONE_DIR is hard to remember and again is on the longer side.
Co-authored-by: 罗泽轩 <[email protected]>
|
|
||
| ## DESCRIPTION | ||
|
|
||
| Clones a Git repository under the directory specified by the environment variable `GIT_EXTRA_DEFAULT_CLONE_PATH` |
There was a problem hiding this comment.
What about using a git config like the other scripts?
For example,
Line 62 in f5bcbe5
There was a problem hiding this comment.
Yeah that's probably better
| @@ -0,0 +1,35 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
|
Made those changes 👍 |
|
|
||
| ## git get | ||
|
|
||
| Clone repository into `"$HOME/some-dir/<repository_name>"`: |
There was a problem hiding this comment.
Better to mention that this command can clone repo to the configured path, as git clone already support cloning to a specific path.
| git-fork | ||
| git-setup | ||
| git-standup | ||
| git-get |
There was a problem hiding this comment.
Please put it in alphabetical order
aebfef8 to
2493f99
Compare
|
👍 I added the concept of configured path specifically to the documentation |
| Clone repository into a subdirectory of the configured path, `"$HOME/some-dir"`: | ||
|
|
||
| ```bash | ||
| $ git config --add git-extras.get.clone-path "$HOME/some-dir" |
There was a problem hiding this comment.
Look like we need to add --global here?
|
Sorry for the slow changes, made those improvements 👍 |
| dirname=${dirname##*/} | ||
|
|
||
| mkdir -p "$clone_path" | ||
| git clone "$url" "$clone_path/$dirname" |
There was a problem hiding this comment.
Would you add a feature to pass options to git clone or add a TODO comment?
|
|
||
| url=$1 | ||
|
|
||
| if (( $# == 0)); then |
There was a problem hiding this comment.
Better to check num of args before assigning to $url
There was a problem hiding this comment.
My mistake - it has been fixed now.
| exit 0 | ||
| fi | ||
|
|
||
| if ! shift; then |
There was a problem hiding this comment.
Yes, that has now been fixed.
git get- checkout code in opinionated location #999git-extras updateproduces warnings on OS X #455 (code already fixed)