handle a/b from github
This commit is contained in:
parent
de07e62e8e
commit
da436cd3df
1 changed files with 14 additions and 0 deletions
|
|
@ -3,6 +3,20 @@ alias gb='git branch'
|
||||||
alias gs='git status'
|
alias gs='git status'
|
||||||
alias gpcb='git push origin $(git rev-parse --abbrev-ref HEAD)'
|
alias gpcb='git push origin $(git rev-parse --abbrev-ref HEAD)'
|
||||||
|
|
||||||
|
function git() {
|
||||||
|
if [[ $1 == clone && $# -ge 2 ]]; then
|
||||||
|
local url=$2
|
||||||
|
# expand foo/bar -> https://github.com/foo/bar.git (no protocol, no dots in host part)
|
||||||
|
if [[ $url =~ ^[A-Za-z0-9_-]+/[A-Za-z0-9_.-]+$ ]]; then
|
||||||
|
url="https://github.com/${url%.git}.git"
|
||||||
|
echo "Cloning $url" >&2
|
||||||
|
fi
|
||||||
|
command git clone "$url" "${@:3}"
|
||||||
|
else
|
||||||
|
command git "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
alias u='cd ..'
|
alias u='cd ..'
|
||||||
alias uu='cd ../..'
|
alias uu='cd ../..'
|
||||||
alias uuu='cd ../../..'
|
alias uuu='cd ../../..'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue