feat(git): add gccd alias to clone and cd into git repository (#8220)

Fixes #8216
Closes #8220

Co-authored-by: Nelson Estevão <nelsonmestevao@gmail.com>
This commit is contained in:
fanuch 2019-10-06 13:19:14 +11:00 committed by Marc Cornellà
parent 568584a9f5
commit 714399a7c3
No known key found for this signature in database
GPG Key ID: 0314585E776A9C1B
2 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,7 @@ plugins=(... git)
| gcb | git checkout -b | | gcb | git checkout -b |
| gcf | git config --list | | gcf | git config --list |
| gcl | git clone --recurse-submodules | | gcl | git clone --recurse-submodules |
| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" |
| gclean | git clean -id | | gclean | git clean -id |
| gpristine | git reset --hard && git clean -dffx | | gpristine | git reset --hard && git clean -dffx |
| gcm | git checkout $(git_main_branch) | | gcm | git checkout $(git_main_branch) |

View File

@ -97,6 +97,13 @@ alias gcas='git commit -a -s'
alias gcasm='git commit -a -s -m' alias gcasm='git commit -a -s -m'
alias gcb='git checkout -b' alias gcb='git checkout -b'
alias gcf='git config --list' alias gcf='git config --list'
function gccd() {
command git clone --recurse-submodules "$@"
[[ -d "$_" ]] && cd "$_" || cd "${${_:h}%.git}"
}
compdef _git gccd=git-clone
alias gcl='git clone --recurse-submodules' alias gcl='git clone --recurse-submodules'
alias gclean='git clean -id' alias gclean='git clean -id'
alias gpristine='git reset --hard && git clean -dffx' alias gpristine='git reset --hard && git clean -dffx'