Skip to content
View as Markdown

Git

Git operations facade for a specific Sandbox.

Provides repository clone, branch, commit, status, and sync operations mapped to Daytona toolbox Git endpoints.

Methods

clone()

public void clone(String url, String path)

Clones a Git repository into the specified path.

Parameters:

  • url String - repository URL
  • path String - destination path in the Sandbox

Throws:

  • io.daytona.sdk.exception.DaytonaException - if cloning fails

clone()

public 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 URL
  • path String - destination path in the Sandbox
  • branch String - branch to clone; null uses default branch
  • commitId String - commit SHA to checkout after clone; null skips detached checkout
  • username String - username for authenticated remotes
  • password String - password or token for authenticated remotes

Throws:

  • io.daytona.sdk.exception.DaytonaException - if cloning fails

branches()

public Map<String, Object> branches(String path)

Lists branches in a repository.

Parameters:

  • path String - repository path in the Sandbox

Returns:

  • Map\<String, Object\> - map containing branches list

Throws:

  • io.daytona.sdk.exception.DaytonaException - if the operation fails

add()

public void add(String path, List<String> files)

Stages files for commit.

Parameters:

  • path String - repository path in the Sandbox
  • files List<String> - file paths to stage relative to repository root

Throws:

  • io.daytona.sdk.exception.DaytonaException - if staging fails

commit()

public GitCommitResponse commit(String path, String message, String author, String email)

Creates a commit from staged changes.

Parameters:

  • path String - repository path in the Sandbox
  • message String - commit message
  • author String - author display name
  • email String - author email address

Returns:

  • GitCommitResponse - commit metadata containing resulting hash

Throws:

  • io.daytona.sdk.exception.DaytonaException - if commit fails

status()

public GitStatus status(String path)

Retrieves Git status for a repository.

Parameters:

  • path String - repository path in the Sandbox

Returns:

  • GitStatus - repository status including branch divergence and file status entries

Throws:

  • io.daytona.sdk.exception.DaytonaException - if the operation fails

push()

public void push(String path)

Pushes local commits to remote.

Parameters:

  • path String - repository path in the Sandbox

Throws:

  • io.daytona.sdk.exception.DaytonaException - if push fails

pull()

public void pull(String path)

Pulls updates from remote.

Parameters:

  • path String - repository path in the Sandbox

Throws:

  • io.daytona.sdk.exception.DaytonaException - if pull fails