Skip to content

Instantly share code, notes, and snippets.

@michael-go
michael-go / github-clone-alias.sh
Last active March 26, 2023 14:25
alias to clone github repo to org/repo folder
github-clone(){org=$(echo $1 | sed -E 's/.*github\.com.([^/]*)\/.*/\1/') && repo=$(echo $1 | sed -E 's/.*github\.com.[^/]*\/(.*)\.git/\1/') && git clone $1 $org/$repo}
# Example usage:
# > github-clone git@github.com:microsoft/vscode.git
# or
# > github-clone https://github.com/microsoft/vscode.git
#
# both will clone into ./microsoft/vscode instead of just ./vscode