apps/docs/src/content/docs/en/java-sdk/git.mdx
Git operations facade for a specific Sandbox.
Provides repository clone, branch, commit, status, and sync operations mapped to Daytona toolbox Git endpoints.
public void clone(String url, String path)
Clones a Git repository into the specified path.
Parameters:
url String - repository URLpath String - destination path in the SandboxThrows:
io.daytona.sdk.exception.DaytonaException - if cloning failspublic void clone(String url, String path, String branch, String commitId, String username, String password)
Clones a repository with optional branch, commit, and credentials.
Parameters:
url String - repository URLpath String - destination path in the Sandboxbranch String - branch to clone; null uses default branchcommitId String - commit SHA to checkout after clone; null skips detached checkoutusername String - username for authenticated remotespassword String - password or token for authenticated remotesThrows:
io.daytona.sdk.exception.DaytonaException - if cloning failspublic Map<String, Object> branches(String path)
Lists branches in a repository.
Parameters:
path String - repository path in the SandboxReturns:
Map\<String, Object\> - map containing branches listThrows:
io.daytona.sdk.exception.DaytonaException - if the operation failspublic void add(String path, List<String> files)
Stages files for commit.
Parameters:
path String - repository path in the Sandboxfiles List<String> - file paths to stage relative to repository rootThrows:
io.daytona.sdk.exception.DaytonaException - if staging failspublic GitCommitResponse commit(String path, String message, String author, String email)
Creates a commit from staged changes.
Parameters:
path String - repository path in the Sandboxmessage String - commit messageauthor String - author display nameemail String - author email addressReturns:
GitCommitResponse - commit metadata containing resulting hashThrows:
io.daytona.sdk.exception.DaytonaException - if commit failspublic GitStatus status(String path)
Retrieves Git status for a repository.
Parameters:
path String - repository path in the SandboxReturns:
GitStatus - repository status including branch divergence and file status entriesThrows:
io.daytona.sdk.exception.DaytonaException - if the operation failspublic void push(String path)
Pushes local commits to remote.
Parameters:
path String - repository path in the SandboxThrows:
io.daytona.sdk.exception.DaytonaException - if push failspublic void pull(String path)
Pulls updates from remote.
Parameters:
path String - repository path in the SandboxThrows:
io.daytona.sdk.exception.DaytonaException - if pull fails