Skip to content

Instantly share code, notes, and snippets.

@jkrems
Created July 7, 2020 16:24
Show Gist options
  • Save jkrems/69bec370f92c82935bf88fa869d6b338 to your computer and use it in GitHub Desktop.
Save jkrems/69bec370f92c82935bf88fa869d6b338 to your computer and use it in GitHub Desktop.
Switch to Github repo checkout, clone if it doesn't exist yet
# Usage: gh <org-or-user>/<repo>
# Example: gh nodejs/node
gh () {
local repo=$1
local target="$HOME/code/src/github.com/$1"
local url="[email protected]:$repo.git"
if [[ ! -d "$target" ]]
then
git clone "$url" "$target"
fi
cd "$target"
}
@jkrems
Copy link
Author

jkrems commented Jul 7, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment