Git
Git operations inside the sandbox.
Git performs git operations on repositories inside a sandbox. Obtain it as sandbox.git. Every method takes the repository's in-sandbox path as its first argument. For private repositories, clone/push/pull accept username/password (use a personal access token as the password). See the git guide.
clone()
Clones a repository into the sandbox, optionally at a specific branch or commit, and optionally with credentials for private repos.
| Parameter | Type | Default | Description |
|---|---|---|---|
url | str | — | Repository URL. |
path | str | — | In-sandbox destination directory. |
branch | str | None | Branch to check out. |
commit_id | str | None | Specific commit to check out. |
username | str | None | Username for private repos. |
password | str | None | Password or access token. |
status()
Returns the working-tree status of a repository: current branch, ahead/behind counts, and per-file staging/worktree state.
branches()
Lists the branches of a repository.
Returns: a dict with a branches list.
create_branch()
Creates a new branch.
delete_branch()
Deletes a branch.
checkout_branch()
Checks out an existing branch.
add()
Stages files for the next commit. Paths in files are relative to the repository root.
commit()
Commits staged changes with the given message and author identity.
| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | — | Repository path. |
message | str | — | Commit message. |
author | str | — | Author name. |
email | str | — | Author email. |
Returns: a dict with the commit hash.
push()
Pushes commits to the remote. Provide username/password for private remotes.
pull()
Pulls from the remote. Provide username/password for private remotes.