{
  "$type": "site.standard.document",
  "description": "Quick reference for common Git commands and workflows.",
  "path": "/writing/git",
  "publishedAt": "2026-05-18T00:00:00.000Z",
  "site": "at://did:plc:m25hu5wadnbqnt47zep7xza6/site.standard.publication/self",
  "textContent": "## Switching Branches\n\nFor existing branches:\n\n```sh\ngit switch <branch-name>\n```\n\nTo create new branches:\n\n```sh\ngit switch -c <new-branch-name>\n```\n\nRead more about [`git switch vs. git checkout`](https://dev.to/softheartengineer/why-use-git-switch-instead-of-git-checkout-3ojb).\n\nManual reference: [`git switch`](https://git-scm.com/docs/git-switch).\n\n## Working with Worktrees\n\nList all attached worktrees:\n\n```sh\ngit worktree list\n```\n\nCreate a new worktree for a branch (creates the branch if needed):\n\n```sh\ngit worktree add -b <new-branch-name> ../<folder-name>\n```\n\nCreate a worktree for an existing branch:\n\n```sh\ngit worktree add ../<folder-name> <branch-name>\n```\n\nRemove a worktree when done:\n\n```sh\ngit worktree remove ../<folder-name>\n```\n\nClean up stale worktree metadata:\n\n```sh\ngit worktree prune\n```\n\nManual reference: [`git worktree`](https://git-scm.com/docs/git-worktree).",
  "title": "Git Cheatsheet"
}