Git
Clone, commit, push and inspect repositories inside a sandbox.
Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.
sandbox.git. Paths are repository directories in the sandbox.
Properties
Section titled “Properties”Python exposes these as methods; see below.
TypeScript exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
NetworkTimeoutSeconds |
uint32 |
|
NoEgressProxy |
bool |
NoEgressProxy turns off the automatic proxy settings for network operations (see EgressEnv). |
Timeout |
uint32 |
Ruby exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
networkTimeoutSeconds |
int |
|
timeoutSeconds |
int |
|
useEgressProxy |
boolean |
Route network operations through the sandbox’s layer-7 egress proxy while its rules are on (see egressEnv). |
def add(self, repo: str, paths: list[str] | None=None) -> NoneStage paths, or everything (including deletions) when none are given.
| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
paths |
list[str] | None |
None |
sdk/python/svm/git.py:180async add(repo: string, opts: { paths?: string[] } = {}): Promise<void>Stage paths, or everything (including deletions) when none are given.
| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ paths?: string[] } |
{} |
sdk/typescript/src/git-client.ts:189func (g *Git) Add(ctx context.Context, repo string, paths ...string) errorAdd stages paths, or everything (including deletions) when none are given.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
paths |
...string |
optional |
Returns error
sdk/go/git_client.go:292def add(repo, paths: [])Stages paths, or everything (including deletions) when none are given.
| Parameter | Type | Default |
|---|---|---|
repo |
||
paths |
[] |
sdk/ruby/lib/svm/git.rb:143public void add(String repo, String... paths)Stages paths, or everything (including deletions) when none are given.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
paths |
String... |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:228add_remote()
Section titled “add_remote()”def add_remote(self, repo: str, name: str, url: str, *, fetch: bool=False, allowed_hosts: set[str] | None=None) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
name |
str |
|
url |
str |
|
fetch |
bool |
False |
allowed_hosts |
set[str] | None |
None |
sdk/python/svm/git.py:224async addRemote(repo: string, name: string, url: string, opts: { fetch?: boolean; allowedHosts?: Set<string> } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
name |
string |
|
url |
string |
|
opts |
{ fetch?: boolean; allowedHosts?: Set<string> } |
{} |
sdk/typescript/src/git-client.ts:225func (g *Git) AddRemote(ctx context.Context, repo, name, remoteURL string, fetch bool, allowedHosts map[string]bool) errorAddRemote adds a remote, fetching it when fetch is set.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
name |
string |
|
remoteURL |
string |
|
fetch |
bool |
|
allowedHosts |
map[string]bool |
Returns error
sdk/go/git_client.go:397def add_remote(repo, name, url, fetch: false, allowed_hosts: nil)| Parameter | Type | Default |
|---|---|---|
repo |
||
name |
||
url |
||
fetch |
false |
|
allowed_hosts |
nil |
sdk/ruby/lib/svm/git.rb:196public void addRemote(String repo, String name, String url, boolean fetch, Set<String> allowedHosts)| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
name |
String |
|
url |
String |
|
fetch |
boolean |
|
allowedHosts |
Set<String> |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:277branches()
Section titled “branches()”def branches(self, repo: str) -> GitBranches| Parameter | Type | Default |
|---|---|---|
repo |
str |
Returns GitBranches
sdk/python/svm/git.py:156async branches(repo: string): Promise<GitBranches>| Parameter | Type | Default |
|---|---|---|
repo |
string |
Returns Promise<GitBranches>
sdk/typescript/src/git-client.ts:164func (g *Git) Branches(ctx context.Context, repo string) (GitBranches, error)Branches lists local and remote-tracking branches and the current one.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
Returns (GitBranches, error)
sdk/go/git_client.go:227def branches(repo)Local and remote-tracking branches and the current one.
| Parameter | Type | Default |
|---|---|---|
repo |
sdk/ruby/lib/svm/git.rb:102public Branches branches(String repo)| Parameter | Type | Default |
|---|---|---|
repo |
String |
Returns Branches
sdk/java/src/main/java/dev/svm/sandbox/Git.java:196checkout()
Section titled “checkout()”def checkout(self, repo: str, ref: str) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
ref |
str |
sdk/python/svm/git.py:173async checkout(repo: string, ref: string): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
ref |
string |
sdk/typescript/src/git-client.ts:182func (g *Git) Checkout(ctx context.Context, repo, ref string) errorCheckout switches to a branch or revision.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
ref |
string |
Returns error
sdk/go/git_client.go:270def checkout(repo, ref)| Parameter | Type | Default |
|---|---|---|
repo |
||
ref |
sdk/ruby/lib/svm/git.rb:130public void checkout(String repo, String ref)| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
ref |
String |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:223clone()
Section titled “clone()”def clone(self, url: str, path: str, *, branch: str | None=None, depth: int | None=None, allowed_hosts: set[str] | None=None) -> strClone an HTTPS repository into path; returns path. allowed_hosts limits where it may come from.
| Parameter | Type | Default |
|---|---|---|
url |
str |
|
path |
str |
|
branch |
str | None |
None |
depth |
int | None |
None |
allowed_hosts |
set[str] | None |
None |
Returns str
sdk/python/svm/git.py:125async clone(url: string, path: string, opts: { branch?: string; depth?: number; allowedHosts?: Set<string> } = {}): Promise<string>| Parameter | Type | Default |
|---|---|---|
url |
string |
|
path |
string |
|
opts |
{ branch?: string; depth?: number; allowedHosts?: Set<string> } |
{} |
Returns Promise<string>
sdk/typescript/src/git-client.ts:133func (g *Git) Clone(ctx context.Context, repoURL, path string, o GitCloneOptions) errorClone clones an HTTPS repository (or a repository path in the sandbox) into path.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repoURL |
string |
|
path |
string |
|
o |
GitCloneOptions |
Returns error
sdk/go/git_client.go:141def clone(url, path, branch: nil, depth: nil, allowed_hosts: nil)| Parameter | Type | Default |
|---|---|---|
url |
||
path |
||
branch |
nil |
|
depth |
nil |
|
allowed_hosts |
nil |
sdk/ruby/lib/svm/git.rb:58public void clone(String url, String path, String branch, Integer depth, Set<String> allowedHosts)Clones an HTTPS repository (or a repository path in the sandbox) into path; branch, depth and allowedHosts may be null.
| Parameter | Type | Default |
|---|---|---|
url |
String |
|
path |
String |
|
branch |
String |
|
depth |
Integer |
|
allowedHosts |
Set<String> |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:159commit()
Section titled “commit()”def commit(self, repo: str, message: str, *, author_name: str | None=None, author_email: str | None=None, allow_empty: bool=False) -> strCommit what is staged; returns the new commit id.
| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
message |
str |
|
author_name |
str | None |
None |
author_email |
str | None |
None |
allow_empty |
bool |
False |
Returns str
sdk/python/svm/git.py:184async commit(repo: string, message: string, opts: { authorName?: string; authorEmail?: string; allowEmpty?: boolean } = {}): Promise<string>Commit what is staged; resolves to the new commit id.
| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
message |
string |
|
opts |
{ authorName?: string; authorEmail?: string; allowEmpty?: boolean } |
{} |
Returns Promise<string>
sdk/typescript/src/git-client.ts:194func (g *Git) Commit(ctx context.Context, repo, message string, o GitCommitOptions) (string, error)Commit commits what is staged and returns the new commit id.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
message |
string |
|
o |
GitCommitOptions |
Returns (string, error)
sdk/go/git_client.go:311def commit(repo, message, author_name: nil, author_email: nil, allow_empty: false)Commits what is staged and returns the new commit id.
| Parameter | Type | Default |
|---|---|---|
repo |
||
message |
||
author_name |
nil |
|
author_email |
nil |
|
allow_empty |
false |
sdk/ruby/lib/svm/git.rb:150public String commit(String repo, String message, String authorName, String authorEmail, boolean allowEmpty)Commits what is staged and returns the new commit id; the author fields may be null.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
message |
String |
|
authorName |
String |
|
authorEmail |
String |
|
allowEmpty |
boolean |
Returns String
sdk/java/src/main/java/dev/svm/sandbox/Git.java:234configure_user()
Section titled “configure_user()”def configure_user(self, name: str, email: str, *, scope: str='global', repo: str | None=None) -> None| Parameter | Type | Default |
|---|---|---|
name |
str |
|
email |
str |
|
scope |
str |
'global' |
repo |
str | None |
None |
sdk/python/svm/git.py:260async configureUser(name: string, email: string, opts: { scope?: GitConfigScope; repo?: string } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
name |
string |
|
email |
string |
|
opts |
{ scope?: GitConfigScope; repo?: string } |
{} |
sdk/typescript/src/git-client.ts:261func (g *Git) ConfigureUser(ctx context.Context, name, email, scope, repo string) errorConfigureUser sets user.name and user.email.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
email |
string |
|
scope |
string |
|
repo |
string |
Returns error
sdk/go/git_config.go:58def configure_user(name, email, scope: "global", repo: nil)| Parameter | Type | Default |
|---|---|---|
name |
||
email |
||
scope |
"global" |
|
repo |
nil |
sdk/ruby/lib/svm/git.rb:258public void configureUser(String name, String email, String scope, String repo)| Parameter | Type | Default |
|---|---|---|
name |
String |
|
email |
String |
|
scope |
String |
|
repo |
String |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:328constructor()
Section titled “constructor()”Not in the Python SDK’s Git.
constructor(private readonly sandbox: Runner, private readonly options: { timeoutSeconds?: number; networkTimeoutSeconds?: number; useEgressProxy?: boolean } = {})| Parameter | Type | Default |
|---|---|---|
sandbox |
Runner |
|
options |
{ timeoutSeconds?: number; networkTimeoutSeconds?: number; useEgressProxy?: boolean } |
{} |
sdk/typescript/src/git-client.ts:115Not in the Go SDK’s Git.
Not in the Ruby SDK’s Git.
Not in the Java SDK’s Git.
create_branch()
Section titled “create_branch()”def create_branch(self, repo: str, name: str, *, start: str | None=None, checkout: bool=True) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
name |
str |
|
start |
str | None |
None |
checkout |
bool |
True |
sdk/python/svm/git.py:169async createBranch(repo: string, name: string, opts: { start?: string; checkout?: boolean } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
name |
string |
|
opts |
{ start?: string; checkout?: boolean } |
{} |
sdk/typescript/src/git-client.ts:177func (g *Git) CreateBranch(ctx context.Context, repo, name, start string, checkout bool) errorCreateBranch creates name at start (HEAD when empty) and, when checkout is set (Python’s default), switches to it.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
name |
string |
|
start |
string |
|
checkout |
bool |
Returns error
sdk/go/git_client.go:251def create_branch(repo, name, start: nil, checkout: true)Creates name at start (HEAD by default) and switches to it when checkout (the default), as Python’s.
| Parameter | Type | Default |
|---|---|---|
repo |
||
name |
||
start |
nil |
|
checkout |
true |
sdk/ruby/lib/svm/git.rb:119public void createBranch(String repo, String name)public void createBranch(String repo, String name, String start, boolean checkout)Creates name at HEAD and switches to it (Python’s create_branch(repo, name), checkout=True).
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
name |
String |
|
start |
String |
optional |
checkout |
boolean |
optional |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:213delete_branch()
Section titled “delete_branch()”def delete_branch(self, repo: str, name: str, *, force: bool=False) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
name |
str |
|
force |
bool |
False |
sdk/python/svm/git.py:176async deleteBranch(repo: string, name: string, opts: { force?: boolean } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
name |
string |
|
opts |
{ force?: boolean } |
{} |
sdk/typescript/src/git-client.ts:184func (g *Git) DeleteBranch(ctx context.Context, repo, name string, force bool) errorDeleteBranch deletes a merged branch, or any branch with force.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
name |
string |
|
force |
bool |
Returns error
sdk/go/git_client.go:279def delete_branch(repo, name, force: false)| Parameter | Type | Default |
|---|---|---|
repo |
||
name |
||
force |
false |
sdk/ruby/lib/svm/git.rb:136public void deleteBranch(String repo, String name, boolean force)| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
name |
String |
|
force |
boolean |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:225diff()
Section titled “diff()”def diff(self, repo: str, *, staged: bool=False, paths: list[str] | None=None) -> str| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
staged |
bool |
False |
paths |
list[str] | None |
None |
Returns str
sdk/python/svm/git.py:152async diff(repo: string, opts: { staged?: boolean; paths?: string[] } = {}): Promise<string>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ staged?: boolean; paths?: string[] } |
{} |
Returns Promise<string>
sdk/typescript/src/git-client.ts:160func (g *Git) Diff(ctx context.Context, repo string, staged bool, paths ...string) (string, error)Diff returns the working-tree diff, or the staged one.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
staged |
bool |
|
paths |
...string |
optional |
Returns (string, error)
sdk/go/git_client.go:214def diff(repo, staged: false, paths: [])The working-tree diff, or the staged one.
| Parameter | Type | Default |
|---|---|---|
repo |
||
staged |
false |
|
paths |
[] |
sdk/ruby/lib/svm/git.rb:96public String diff(String repo, boolean staged, String... paths)The working-tree diff, or the staged one.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
staged |
boolean |
|
paths |
String... |
Returns String
sdk/java/src/main/java/dev/svm/sandbox/Git.java:188egress_env()
Section titled “egress_env()”def egress_env(self) -> dict[str, str]The proxy settings git needs while the sandbox’s layer-7 egress is on, else {}.
With the firewall on, HTTPS leaves the sandbox only through the proxy, which signs with the sandbox’s CA: git needs HTTPS_PROXY (the sandbox’s own proxy URL, credentials included) and GIT_SSL_CAINFO (the CA, written to ~/.svm/egress-ca.pem, owner-only). They are read from get_sandbox_egress at each network operation, so rules turned on or off later are followed, and passed as the command’s environment, not on its command line. Without the firewall, or without permission to read it, git runs as it always did.
Returns dict[str, str]
Raises GitError
sdk/python/svm/git.py:93egressEnv(): Promise<Record<string, string>>The proxy settings network operations carry while the sandbox’s layer-7 egress is on (see egressGitEnv); {} otherwise or with useEgressProxy: false.
Returns Promise<Record<string, string>>
sdk/typescript/src/git-client.ts:123func (g *Git) EgressEnv(ctx context.Context) (map[string]string, error)EgressEnv is the proxy settings network operations carry while the sandbox’s layer-7 egress is on (see EgressEnv); nil otherwise.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns (map[string]string, error)
sdk/go/git_client.go:107def egress_envThe proxy settings git needs while the sandbox’s layer-7 egress is on, else {}: HTTPS_PROXY (the sandbox’s own proxy URL, credentials included) and GIT_SSL_CAINFO (the CA, written owner-only to ~/.svm/egress-ca.pem). Read at each network operation and passed as the command’s environment, not on its command line; without the firewall, or without permission to read it, git runs as it always did.
Raises GitError
sdk/ruby/lib/svm/git.rb:51public Map<String, String> egressEnv()The proxy settings git needs while the sandbox’s layer-7 egress is on, else an empty map. With the firewall on, HTTPS leaves the sandbox only through the proxy, which signs with the sandbox’s CA: git needs HTTPS_PROXY (the sandbox’s proxy URL, credentials included) and GIT_SSL_CAINFO (the CA, written owner-only to ~/.svm/egress-ca.pem). They are read at each network operation and passed as the command’s environment, never on its command line. Without the firewall, or without permission to read it, git runs as it always did.
Returns Map<String, String>
Raises GitException
sdk/java/src/main/java/dev/svm/sandbox/Git.java:95fetch()
Section titled “fetch()”def fetch(self, repo: str, *, remote: str='origin', prune: bool=False) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
remote |
str |
'origin' |
prune |
bool |
False |
sdk/python/svm/git.py:244async fetch(repo: string, opts: { remote?: string; prune?: boolean } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ remote?: string; prune?: boolean } |
{} |
sdk/typescript/src/git-client.ts:243func (g *Git) Fetch(ctx context.Context, repo, remote string, prune bool) errorFetch fetches a remote (“origin” when empty).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
remote |
string |
|
prune |
bool |
Returns error
sdk/go/git_client.go:485def fetch(repo, remote: "origin", prune: false)| Parameter | Type | Default |
|---|---|---|
repo |
||
remote |
"origin" |
|
prune |
false |
sdk/ruby/lib/svm/git.rb:236public void fetch(String repo, String remote, boolean prune)| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
remote |
String |
|
prune |
boolean |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:307get_config()
Section titled “get_config()”def get_config(self, key: str, *, scope: str='global', repo: str | None=None) -> str | None| Parameter | Type | Default |
|---|---|---|
key |
str |
|
scope |
str |
'global' |
repo |
str | None |
None |
Returns str \| None
Raises GitError
sdk/python/svm/git.py:251async getConfig(key: string, opts: { scope?: GitConfigScope; repo?: string } = {}): Promise<string | null>The value, or null when the key is not set.
| Parameter | Type | Default |
|---|---|---|
key |
string |
|
opts |
{ scope?: GitConfigScope; repo?: string } |
{} |
Returns Promise<string \| null>
Raises GitError
sdk/typescript/src/git-client.ts:253func (g *Git) GetConfig(ctx context.Context, key, scope, repo string) (string, bool, error)GetConfig returns the value of key and whether it is set.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
key |
string |
|
scope |
string |
|
repo |
string |
Returns (string, bool, error)
sdk/go/git_config.go:42def get_config(key, scope: "global", repo: nil)The value of key, or nil when it is not set.
| Parameter | Type | Default |
|---|---|---|
key |
||
scope |
"global" |
|
repo |
nil |
Raises GitError
sdk/ruby/lib/svm/git.rb:250public String getConfig(String key, String scope, String repo)The value of key, or null when it is not set.
| Parameter | Type | Default |
|---|---|---|
key |
String |
|
scope |
String |
|
repo |
String |
Returns String
Raises GitException
sdk/java/src/main/java/dev/svm/sandbox/Git.java:320initialize()
Section titled “initialize()”Not in the Python SDK’s Git.
Not in the TypeScript SDK’s Git.
Not in the Go SDK’s Git.
def initialize(box, sandbox: nil, timeout_seconds: 60, network_timeout_seconds: 300, use_egress_proxy: true)box answers run(command, timeout_seconds:) with a result that has stdout, stderr and exit_code (a Sandbox’s commands do). sandbox (Sandbox#git passes it) is where #egress_env reads the egress settings; use_egress_proxy false never uses the proxy. timeout_seconds bounds a local git command and network_timeout_seconds one that talks to a remote, as in Python.
| Parameter | Type | Default |
|---|---|---|
box |
||
sandbox |
nil |
|
timeout_seconds |
60 |
|
network_timeout_seconds |
300 |
|
use_egress_proxy |
true |
sdk/ruby/lib/svm/git.rb:26Not in the Java SDK’s Git.
install_credentials()
Section titled “install_credentials()”def install_credentials(self, git_config: str) -> NoneAppend the create response’s scoped proxy configuration (access.git_config) to ~/.gitconfig, owner-only.
The configuration holds only a scoped token the proxy swaps for the team’s credential; nothing else is accepted.
| Parameter | Type | Default |
|---|---|---|
git_config |
str |
Raises GitError
sdk/python/svm/git.py:273async installCredentials(gitConfig: string): Promise<void>Append the create response’s scoped proxy configuration (access.gitConfig) to ~/.gitconfig, owner-only.
| Parameter | Type | Default |
|---|---|---|
gitConfig |
string |
sdk/typescript/src/git-client.ts:275func (g *Git) InstallCredentials(ctx context.Context, gitConfig string) errorInstallCredentials appends the create response’s scoped proxy configuration to ~/.gitconfig, owner-only.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
gitConfig |
string |
Returns error
sdk/go/git_config.go:66def install_credentials(git_config)Appends the create response’s scoped proxy configuration (access[“git_config”]) to ~/.gitconfig, owner-only. Only what the platform writes is accepted: [url “…”] sections with insteadOf, and [http “…”] sections whose extraHeader is the scoped X-Fcap-Credential token (never a secret). Anything else (an Authorization header, core.pager, [include], another section or key) raises ArgumentError before anything reaches the sandbox.
| Parameter | Type | Default |
|---|---|---|
git_config |
Raises ArgumentError, GitError
sdk/ruby/lib/svm/git.rb:267public void installCredentials(String gitConfig)Appends the create response’s scoped proxy configuration (access.git_config) to ~/.gitconfig, owner-only. The configuration holds only a scoped token the proxy swaps for the team’s credential, and only the lines the platform writes are accepted: a [url "<proxy>/https://<host>/"] section with insteadOf = https://<host>/, and an [http "<url>"] section with extraHeader = X-Fcap-Credential: fcapg_.... Anything else (another section, core.pager, [include], a comment, another header) is refused before anything is written.
| Parameter | Type | Default |
|---|---|---|
gitConfig |
String |
Raises GitException
sdk/java/src/main/java/dev/svm/sandbox/Git.java:122def log(self, repo: str, *, limit: int=20, ref: str='HEAD') -> list[GitCommit]| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
limit |
int |
20 |
ref |
str |
'HEAD' |
Returns list[GitCommit]
sdk/python/svm/git.py:146async log(repo: string, opts: { limit?: number; ref?: string } = {}): Promise<GitCommit[]>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ limit?: number; ref?: string } |
{} |
Returns Promise<GitCommit[]>
sdk/typescript/src/git-client.ts:154func (g *Git) Log(ctx context.Context, repo string, limit int, ref string) ([]GitCommit, error)Log returns up to limit commits reachable from ref (“HEAD” when empty).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
limit |
int |
|
ref |
string |
Returns ([]GitCommit, error)
sdk/go/git_client.go:196def log(repo, limit: 20, ref: "HEAD")Up to limit commits reachable from ref.
| Parameter | Type | Default |
|---|---|---|
repo |
||
limit |
20 |
|
ref |
"HEAD" |
sdk/ruby/lib/svm/git.rb:89public List<Commit> log(String repo, int limit, String ref)Up to limit commits reachable from ref (“HEAD” when null).
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
limit |
int |
|
ref |
String |
Returns List<Commit>
sdk/java/src/main/java/dev/svm/sandbox/Git.java:180pull()
Section titled “pull()”def pull(self, repo: str, *, remote: str | None=None, branch: str | None=None, rebase: bool=False) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
remote |
str | None |
None |
branch |
str | None |
None |
rebase |
bool |
False |
sdk/python/svm/git.py:237async pull(repo: string, opts: { remote?: string; branch?: string; rebase?: boolean } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ remote?: string; branch?: string; rebase?: boolean } |
{} |
sdk/typescript/src/git-client.ts:237func (g *Git) Pull(ctx context.Context, repo string, o GitPullOptions) errorPull fetches and merges (or rebases onto) the upstream.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
o |
GitPullOptions |
Returns error
sdk/go/git_client.go:460def pull(repo, remote: nil, branch: nil, rebase: false)Fetches and merges (or rebases onto) the upstream, or remote and branch.
| Parameter | Type | Default |
|---|---|---|
repo |
||
remote |
nil |
|
branch |
nil |
|
rebase |
false |
sdk/ruby/lib/svm/git.rb:221public void pull(String repo, String remote, String branch, boolean rebase)Fetches and merges (or rebases onto) the upstream, or remote and branch.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
remote |
String |
|
branch |
String |
|
rebase |
boolean |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:299push()
Section titled “push()”def push(self, repo: str, *, remote: str='origin', branch: str | None=None, set_upstream: bool=False, force: bool=False) -> NonePush branch (default: the current one). force uses --force-with-lease, never a blind force.
| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
remote |
str |
'origin' |
branch |
str | None |
None |
set_upstream |
bool |
False |
force |
bool |
False |
sdk/python/svm/git.py:231async push(repo: string, opts: { remote?: string; branch?: string; setUpstream?: boolean; force?: boolean } = {}): Promise<void>Push branch (default: the current one). force uses --force-with-lease, never a blind force.
| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ remote?: string; branch?: string; setUpstream?: boolean; force?: boolean } |
{} |
sdk/typescript/src/git-client.ts:232func (g *Git) Push(ctx context.Context, repo string, o GitPushOptions) errorPush pushes a branch.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
o |
GitPushOptions |
Returns error
sdk/go/git_client.go:428def push(repo, remote: "origin", branch: nil, set_upstream: false, force: false)Pushes a branch (the current one by default) to remote; force uses –force-with-lease.
| Parameter | Type | Default |
|---|---|---|
repo |
||
remote |
"origin" |
|
branch |
nil |
|
set_upstream |
false |
|
force |
false |
sdk/ruby/lib/svm/git.rb:210public void push(String repo, String remote, String branch, boolean setUpstream, boolean force)Pushes a branch (the current one when null) to remote (“origin” when null); force uses –force-with-lease.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
remote |
String |
|
branch |
String |
|
setUpstream |
boolean |
|
force |
boolean |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:286remotes()
Section titled “remotes()”def remotes(self, repo: str) -> dict[str, str]Remote name to fetch URL.
| Parameter | Type | Default |
|---|---|---|
repo |
str |
Returns dict[str, str]
sdk/python/svm/git.py:213async remotes(repo: string): Promise<Record<string, string>>Remote name to fetch URL.
| Parameter | Type | Default |
|---|---|---|
repo |
string |
Returns Promise<Record<string, string>>
sdk/typescript/src/git-client.ts:216func (g *Git) Remotes(ctx context.Context, repo string) (map[string]string, error)Remotes maps each remote’s name to its fetch URL.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
Returns (map[string]string, error)
sdk/go/git_client.go:381def remotes(repo)Each remote’s name mapped to its fetch URL.
| Parameter | Type | Default |
|---|---|---|
repo |
sdk/ruby/lib/svm/git.rb:189public Map<String, String> remotes(String repo)Each remote’s name mapped to its fetch URL.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
Returns Map<String, String>
sdk/java/src/main/java/dev/svm/sandbox/Git.java:268remove_remote()
Section titled “remove_remote()”def remove_remote(self, repo: str, name: str) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
name |
str |
sdk/python/svm/git.py:228async removeRemote(repo: string, name: string): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
name |
string |
sdk/typescript/src/git-client.ts:229func (g *Git) RemoveRemote(ctx context.Context, repo, name string) errorRemoveRemote removes a remote.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
name |
string |
Returns error
sdk/go/git_client.go:413def remove_remote(repo, name)| Parameter | Type | Default |
|---|---|---|
repo |
||
name |
sdk/ruby/lib/svm/git.rb:203public void removeRemote(String repo, String name)| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
name |
String |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:283reset()
Section titled “reset()”def reset(self, repo: str, *, ref: str='HEAD', mode: str='mixed', paths: list[str] | None=None) -> None| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
ref |
str |
'HEAD' |
mode |
str |
'mixed' |
paths |
list[str] | None |
None |
sdk/python/svm/git.py:197async reset(repo: string, opts: { ref?: string; mode?: (typeof RESET_MODES)[number]; paths?: string[] } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
opts |
{ ref?: string; mode?: (typeof RESET_MODES)[number]; paths?: string[] } |
{} |
sdk/typescript/src/git-client.ts:201func (g *Git) Reset(ctx context.Context, repo, ref, mode string, paths ...string) errorReset moves HEAD to ref (“HEAD” when empty) with mode soft, mixed (default) or hard, or unstages paths when given.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
ref |
string |
|
mode |
string |
|
paths |
...string |
optional |
Returns error
sdk/go/git_client.go:334def reset(repo, ref: "HEAD", mode: "mixed", paths: [])Moves HEAD to ref with mode soft, mixed (default) or hard, or unstages paths when given.
| Parameter | Type | Default |
|---|---|---|
repo |
||
ref |
"HEAD" |
|
mode |
"mixed" |
|
paths |
[] |
sdk/ruby/lib/svm/git.rb:162public void reset(String repo, String ref, String mode, String... paths)Moves HEAD to ref (“HEAD” when null) with mode soft, mixed (default) or hard, or unstages paths when given.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
ref |
String |
|
mode |
String |
|
paths |
String... |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:246restore()
Section titled “restore()”def restore(self, repo: str, paths: list[str], *, staged: bool=False, source: str | None=None) -> NoneDiscard working-tree changes to paths, or unstage them with staged=True.
| Parameter | Type | Default |
|---|---|---|
repo |
str |
|
paths |
list[str] |
|
staged |
bool |
False |
source |
str | None |
None |
sdk/python/svm/git.py:205async restore(repo: string, paths: string[], opts: { staged?: boolean; source?: string } = {}): Promise<void>Discard working-tree changes to paths, or unstage them with staged.
| Parameter | Type | Default |
|---|---|---|
repo |
string |
|
paths |
string[] |
|
opts |
{ staged?: boolean; source?: string } |
{} |
sdk/typescript/src/git-client.ts:210func (g *Git) Restore(ctx context.Context, repo string, paths []string, staged bool, source string) errorRestore discards working-tree changes to paths, or unstages them when staged; source restores from a revision.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
paths |
[]string |
|
staged |
bool |
|
source |
string |
Returns error
sdk/go/git_client.go:359def restore(repo, paths, staged: false, source: nil)Discards working-tree changes to paths, or unstages them when staged; source restores from a revision.
| Parameter | Type | Default |
|---|---|---|
repo |
||
paths |
||
staged |
false |
|
source |
nil |
sdk/ruby/lib/svm/git.rb:175public void restore(String repo, List<String> paths, boolean staged, String source)Discards working-tree changes to paths, or unstages them when staged; source restores from a revision.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
paths |
List<String> |
|
staged |
boolean |
|
source |
String |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:256def run(self, repo: str | None, *args: str, timeout_seconds: int | None=None, envs: dict[str, str] | None=None) -> ProcessResultAny git command, quoted; the result whatever the exit code. envs are variables for this command only.
| Parameter | Type | Default |
|---|---|---|
repo |
str | None |
|
args |
str |
optional |
timeout_seconds |
int | None |
None |
envs |
dict[str, str] | None |
None |
Returns ProcessResult
sdk/python/svm/git.py:88run(repo: string | undefined, args: string[], timeoutSeconds?: number, envs?: Record<string, string>): Promise<ProcessResult>Any git command, quoted; the result whatever the exit code. envs are variables for this command only.
| Parameter | Type | Default |
|---|---|---|
repo |
string | undefined |
|
args |
string[] |
|
timeoutSeconds |
number |
optional |
envs |
Record<string, string> |
optional |
Returns Promise<ProcessResult>
sdk/typescript/src/git-client.ts:118func (g *Git) Run(ctx context.Context, repo string, timeoutSeconds uint32, args ...string) (ProcessResult, error)Run runs any git command, quoted, and returns the result whatever the exit code.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
|
timeoutSeconds |
uint32 |
|
args |
...string |
optional |
Returns (ProcessResult, error)
sdk/go/git_client.go:95def run(repo, *args, timeout_seconds: nil, envs: nil)Runs any git command, quoted, and returns the result whatever the exit code. envs are variables for this command only.
| Parameter | Type | Default |
|---|---|---|
repo |
||
*args |
optional |
|
timeout_seconds |
nil |
|
envs |
nil |
sdk/ruby/lib/svm/git.rb:42public GuestBox.Out run(String repo, int timeout, String... args)Runs any git command, quoted, and returns the result whatever the exit code.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
timeout |
int |
|
args |
String... |
Returns GuestBox.Out
sdk/java/src/main/java/dev/svm/sandbox/Git.java:73script()
Section titled “script()”Not in the Python SDK’s Git.
Not in the TypeScript SDK’s Git.
Not in the Go SDK’s Git.
def self.script(repo, *args)The shell line for git args in repo (nil for none): quoted, non-interactive.
| Parameter | Type | Default |
|---|---|---|
repo |
||
*args |
optional |
sdk/ruby/lib/svm/git.rb:32public static String script(String repo, String... args)The shell line for git args in repo (null for none): quoted, non-interactive.
| Parameter | Type | Default |
|---|---|---|
repo |
String |
|
args |
String... |
Returns String
sdk/java/src/main/java/dev/svm/sandbox/Git.java:65set_config()
Section titled “set_config()”def set_config(self, key: str, value: str, *, scope: str='global', repo: str | None=None) -> None| Parameter | Type | Default |
|---|---|---|
key |
str |
|
value |
str |
|
scope |
str |
'global' |
repo |
str | None |
None |
sdk/python/svm/git.py:248async setConfig(key: string, value: string, opts: { scope?: GitConfigScope; repo?: string } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
key |
string |
|
value |
string |
|
opts |
{ scope?: GitConfigScope; repo?: string } |
{} |
sdk/typescript/src/git-client.ts:247func (g *Git) SetConfig(ctx context.Context, key, value, scope, repo string) errorSetConfig sets key in scope global (default), local (in repo) or system.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
key |
string |
|
value |
string |
|
scope |
string |
|
repo |
string |
Returns error
sdk/go/git_config.go:32def set_config(key, value, scope: "global", repo: nil)Sets key in scope global (default), local (in repo) or system.
| Parameter | Type | Default |
|---|---|---|
key |
||
value |
||
scope |
"global" |
|
repo |
nil |
sdk/ruby/lib/svm/git.rb:243public void setConfig(String key, String value, String scope, String repo)Sets key in scope global (default), local (in repo) or system.
| Parameter | Type | Default |
|---|---|---|
key |
String |
|
value |
String |
|
scope |
String |
|
repo |
String |
sdk/java/src/main/java/dev/svm/sandbox/Git.java:314status()
Section titled “status()”def status(self, repo: str) -> GitStatus| Parameter | Type | Default |
|---|---|---|
repo |
str |
Returns GitStatus
sdk/python/svm/git.py:143async status(repo: string): Promise<GitStatus>| Parameter | Type | Default |
|---|---|---|
repo |
string |
Returns Promise<GitStatus>
sdk/typescript/src/git-client.ts:150func (g *Git) Status(ctx context.Context, repo string) (GitStatusInfo, error)Status returns the branch, its tracking state and the changed files.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
repo |
string |
Returns (GitStatusInfo, error)
sdk/go/git_client.go:187def status(repo)The branch, its tracking state and the changed files (clean when none).
| Parameter | Type | Default |
|---|---|---|
repo |
sdk/ruby/lib/svm/git.rb:84public Status status(String repo)| Parameter | Type | Default |
|---|---|---|
repo |
String |
Returns Status
sdk/java/src/main/java/dev/svm/sandbox/Git.java:177GitStatus
Section titled “GitStatus”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
ahead |
int |
|
behind |
int |
|
branch |
str |
|
clean |
bool |
|
files |
list[GitFileStatus] |
|
upstream |
str |
| Property | Type | Description |
|---|---|---|
ahead |
number |
|
behind |
number |
|
branch |
string |
|
clean |
boolean |
|
files |
GitFileStatus[] |
|
upstream |
string |
Not in the Go SDK.
Not in the Ruby SDK.
Not in the Java SDK.
GitFileStatus
Section titled “GitFileStatus”GitFileStatus is one porcelain entry: Index and Worktree are the X and Y codes (” “, M, A, D, R, C, U, ? untracked).
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
index |
str |
|
path |
str |
|
renamed_from |
str |
|
worktree |
str |
| Property | Type | Description |
|---|---|---|
index |
string |
|
path |
string |
|
renamedFrom |
string |
|
worktree |
string |
| Property | Type | Description |
|---|---|---|
Index |
string |
|
Path |
string |
|
RenamedFrom |
string |
|
Worktree |
string |
Not in the Ruby SDK.
Not in the Java SDK.
GitBranches
Section titled “GitBranches”GitBranches lists local and remote-tracking branches.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
current |
str |
|
local |
list[str] |
|
remote |
list[str] |
| Property | Type | Description |
|---|---|---|
current |
string |
|
local |
string[] |
|
remote |
string[] |
| Property | Type | Description |
|---|---|---|
Current |
string |
|
Local |
[]string |
|
Remote |
[]string |
Not in the Ruby SDK.
Not in the Java SDK.
GitCommit
Section titled “GitCommit”GitCommit is one log entry.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
author_email |
str |
|
author_name |
str |
|
id |
str |
|
subject |
str |
|
timestamp |
int |
| Property | Type | Description |
|---|---|---|
authorEmail |
string |
|
authorName |
string |
|
id |
string |
|
subject |
string |
|
timestamp |
number |
| Property | Type | Description |
|---|---|---|
AuthorEmail |
string |
|
AuthorName |
string |
|
ID |
string |
|
Subject |
string |
|
Timestamp |
int64 |
Not in the Ruby SDK.
Not in the Java SDK.
GitError
Section titled “GitError”A git command exited non-zero; exit_code, stderr and stdout say why (a pull that stops on a conflict reports it on stdout).
Properties
Section titled “Properties”Python exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
exitCode |
number | undefined |
|
stderr |
string |
|
stdout |
string |
| Property | Type | Description |
|---|---|---|
ExitCode |
int32 |
|
Stderr |
string |
|
Stdout |
string |
|
What |
string |
| Property | Type | Description |
|---|---|---|
exit_code |
||
stderr |
||
what |
Not in the Java SDK.
constructor()
Section titled “constructor()”Not in the Python SDK’s GitError.
constructor(what: string, readonly exitCode: number | undefined, readonly stderr: string, readonly stdout: string = "")| Parameter | Type | Default |
|---|---|---|
what |
string |
|
exitCode |
number | undefined |
|
stderr |
string |
|
stdout |
string |
"" |
sdk/typescript/src/git-client.ts:30Not in the Go SDK’s GitError.
Not in the Ruby SDK’s GitError.
Not in the Java SDK.
error()
Section titled “error()”Not in the Python SDK’s GitError.
Not in the TypeScript SDK’s GitError.
func (e *GitError) Error() stringReturns string
sdk/go/git_status.go:28Not in the Ruby SDK’s GitError.
Not in the Java SDK.
initialize()
Section titled “initialize()”Not in the Python SDK’s GitError.
Not in the TypeScript SDK’s GitError.
Not in the Go SDK’s GitError.
def initialize(what, exit_code, stderr)| Parameter | Type | Default |
|---|---|---|
what |
||
exit_code |
||
stderr |
sdk/ruby/lib/svm/git.rb:10Not in the Java SDK.