Repos is now in Public Beta! Reach out to us at
info@relace.ai if you have any questions or need help with the integration.
Introduction
Standard git workflows like git add
, git commit
, and git push
can be used natively with Relace Repos. Once you clone your repo locally, you can use git commands in your command line or integrate them into your scripts via the Relace SDK.
Before you begin, make sure you’ve created a Relace Repo.
Clone your Relace Repo locally
Start by cloning your repo locally via the Relace SDK so you or your agent can make changes.import { Relace } from '@relace-ai/relace';
const client = new Relace({ apiKey: 'YOUR_API_KEY' });
// Define your local path where the repository will be cloned
const localPath = './my-local-repo';
// Clone a repository by Repo ID
// Optional parameters: depth, branch, quiet, and any additional git clone arguments
await client
.git(localPath)
.clone(
'YOUR_REPO_ID', // Repository ID from Relace
1, // Clone depth (default: 1)
'main', // Branch name (optional)
true, // Quiet mode (default: true)
'--single-branch' // Additional Git arguments (optional)
);
Stage, commit, and push local changes to Relace Repos.
import { Relace } from '@relace-ai/relace';
// Initialize the Relace client with your API key
const client = new Relace({ apiKey: 'YOUR_API_KEY' });
// Define your local repository path and commit message
const localPath = './repo';
const commitMessage = 'Add new file.txt';
// Stage, commit, and push changes to your connected repository
// If no file parameter is passed, `.add()` will default to staging all local changes
client
.git(localPath)
.add('file1.txt')
.commit(commitMessage)
.push();
All usual git commands including git pull, git merge, etc are available through the CLI. The Relace SDK currently only includes functions git add, git commit, git push, and git clone. Other git functionality is coming to the SDK soon.