pub async fn checkout(repo: RepoHandle, opts: CheckoutOpts) -> GitResult<()>Expand description
Execute checkout operation with the given options.
This performs a complete Git checkout operation:
- Resolves the reference to a commit
- Extracts the tree from the commit
- Updates the working directory files
- Updates the index
- Updates HEAD (symbolic for branches, direct for commits/tags)
§Symbolic vs Detached HEAD
- Local branches (e.g., “main”, “refs/heads/feature”) → Symbolic HEAD
- Remote branches (e.g., “origin/main”) → Detached HEAD
- Tags (e.g., “v1.0”, “refs/tags/v1.0”) → Detached HEAD
- Commit SHAs (e.g., “abc123”) → Detached HEAD