Skip to content

Instantly share code, notes, and snippets.

@michael-go
Last active March 26, 2023 14:25
Show Gist options
  • Save michael-go/81f258bffc56ee26e155d9b63faa0a93 to your computer and use it in GitHub Desktop.
Save michael-go/81f258bffc56ee26e155d9b63faa0a93 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment