Skip to content

Instantly share code, notes, and snippets.

@jbarnette
Last active January 4, 2016 12:09
Show Gist options
  • Save jbarnette/8620038 to your computer and use it in GitHub Desktop.
Save jbarnette/8620038 to your computer and use it in GitHub Desktop.
cd to any repo, cloning if necessary
function gd {
local parent=$(dirname "$1")
local name=$(basename "$1")
local owner=$(basename "$parent")
local nwo="$owner/$name"
local dir="$HOME/src/$nwo"
[ -d "$dir" ] || git clone "https://github.com/$nwo" "$dir"
cd "$dir"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment