Git Integrations
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Git Integration system in Daytona provides a comprehensive suite of tools and API endpoints designed to manage version control operations within development sandboxes. This module allows programmatic access to standard Git workflows, including repository cloning, branch management, staging, and committing changes. These integrations are exposed via the Daytona Toolbox API and are accessible through various language-specific SDKs (Go, TypeScript, Python, and Ruby).
The primary purpose of these integrations is to enable autonomous agents and developers to interact with Git repositories directly through the Daytona infrastructure. This ensures that environment state can be synchronized with remote version control providers while maintaining a consistent interface across different programming environments.
Sources: libs/toolbox-api-client-go/api/openapi.yaml, libs/sdk-typescript/README.md, libs/toolbox-api-client-python/README.md
Architecture and API Endpoints
The Git integration is structured as a set of RESTful endpoints under the /git prefix within the Daytona Toolbox API. Each endpoint corresponds to a standard Git command and requires specific request payloads to define the operation's context, such as the repository path or branch name.
Core Git Operations
The system supports the following core operations:
| Endpoint | Method | Description |
|---|---|---|
/git/clone | POST | Clones a repository from a URL to a specific path. |
/git/add | POST | Stages files for a commit. |
/git/commit | POST | Creates a new commit with a message and author info. |
/git/push | POST | Pushes local changes to a remote repository. |
/git/pull | POST | Pulls changes from a remote repository. |
/git/status | GET | Retrieves the current status of the repository (ahead/behind, modified files). |
/git/history | GET | Returns a list of commit metadata. |
Sources: libs/toolbox-api-client-go/api/openapi.yaml:817-987, libs/toolbox-api-client-python/README.md
Branch Management
Branching operations allow for the creation, deletion, and listing of branches within a specific repository path.
| Endpoint | Method | Description |
|---|---|---|
/git/branches | GET | Lists all branches in the repository. |
/git/branches | POST | Creates a new branch. |
/git/branches | DELETE | Deletes an existing branch. |
/git/checkout | POST | Switches the working tree to a specific branch or commit. |
Sources: libs/toolbox-api-client-go/api/openapi.yaml:831-897
Data Models
The Git integration uses structured data models to ensure consistency across the API.
Git Status Model
The GitStatus object provides detailed information about the current state of a repository relative to its remote.
| Field | Type | Description |
|---|---|---|
currentBranch | string | The name of the active branch. |
ahead | integer | Number of commits ahead of remote. |
behind | integer | Number of commits behind remote. |
branchPublished | boolean | Whether the branch exists on the remote. |
fileStatus | array | List of FileStatus objects (modified, untracked, etc.). |
Sources: libs/toolbox-api-client-go/api/openapi.yaml:1449-1473
Git Commit Metadata
The GitCommitInfo structure is used to represent historical data returned by the /git/history endpoint.
{
"author": "string",
"email": "string",
"hash": "string",
"message": "string",
"timestamp": "string"
}
Sources: libs/toolbox-api-client-go/api/openapi.yaml:1410-1430
Implementation Flow
The following diagram illustrates the typical sequence for cloning a repository and committing changes using the Toolbox API.
The diagram shows the interaction between the SDK, the Toolbox API, and the underlying Git system.
Sources: libs/toolbox-api-client/src/api/git-api.ts, libs/toolbox-api-client-go/api/openapi.yaml
Contribution and Commit Standards
The project enforces specific standards for Git usage during the development of Daytona itself. These rules ensure a clean and traceable project history.
- Squashed Commits: All changes for a single feature or PR must be squashed into one commit using
git rebase -i. - Developer Certificate of Origin (DCO): Every commit must be signed off using the
--signoff(or-s) flag to comply with legal requirements. - Rebasing: PRs must be rebased on the
mainbranch rather than usinggit pullto avoid merge commits. - Commit Format: While not strictly enforced, descriptive titles and bullet points for impact are required.
Sources: PREPARING_YOUR_CHANGES.md:1-55
Conclusion
Git Integrations in Daytona serve as the bridge between the isolated sandbox environment and the broader development ecosystem. By exposing Git functionality through a standardized API, Daytona allows for sophisticated automation of development tasks, ranging from simple code updates to complex multi-agent coding workflows.
Sources: libs/sdk-typescript/README.md, libs/toolbox-api-client-go/api/openapi.yaml