Purpose
Clone repositories in a consistent directory structure and ensure Jujutsu is initialized.
Default conventions
- •Prefer
gh repo clonewhen given a GitHub URL orowner/repo. - •Otherwise use
git clone. - •Clone destination:
~/repos/<host>/<org>/<repo>(e.g.,~/repos/github.com/nc-helix/helix-plugins).
Steps
- •Parse the repo identifier (URL or
org/repo) and determinehost,org, andrepo. - •Construct the destination path
~/repos/<host>/<org>/<repo>. - •If the parent directories do not exist, create them.
- •Clone:
- •GitHub URL or
org/repo:gh repo clone <repo> "<dest>" - •Otherwise:
git clone <url> "<dest>"
- •GitHub URL or
- •After cloning, ensure Jujutsu is initialized:
- •If
.jj/is missing, runjj git init --colocateinside the repo.
- •If
Examples
- •Input: "Clone nc-helix/helix-plugins"
- •Destination:
~/repos/github.com/nc-helix/helix-plugins - •Command:
gh repo clone nc-helix/helix-plugins "~/repos/github.com/nc-helix/helix-plugins"
- •Destination:
- •Input: "Clone https://gitlab.com/acme/tools"
- •Destination:
~/repos/gitlab.com/acme/tools - •Command:
git clone https://gitlab.com/acme/tools "~/repos/gitlab.com/acme/tools"
- •Destination:
Edge cases
- •If the destination already exists, warn and ask whether to reuse it.
- •If
ghis missing, fall back togit clone.