Clone a repository locally with git clone and check out a specific branch

domain: git-scm.com/git · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Open a terminal in the directory where you want the repository to appear.
  2. Run git clone with the repository URL; for the default branch use: git clone https://github.com/OWNER/REPO.git. For a specific branch, pass the -b option: git clone -b develop https://github.com/OWNER/REPO.git, optionally combined with --single-branch to fetch history only for that branch.
  3. Wait for the transfer to finish; git creates a new directory named after the repo, initializes a local branch that tracks the remote HEAD (or the -b branch), and sets up the origin remote.
  4. Enter the directory and confirm: git status should report 'On branch <name>' and 'Your branch is up to date with origin/<name>'.
  5. If you cloned into a custom directory name, append it to the command: git clone <url> mycustomdir.

Known gotchas

Related routes

Push local commits to a remote branch with git push
git-scm.com/git · 6 steps · unrated

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans