checkout
codebolt.git.checkout(branchName: string, path: string): Promise<any>
Checks out a branch or commit in the Git repository. Switches the working directory to the specified branch.
Parameters
Name | Type | Description |
---|---|---|
branchName | string | The name of the branch or commit to check out. |
path | string | Optional. The file system path of the local Git repository. If not provided, uses the current directory. |
Returns:
Promise<any>
A promise that resolves with the response from the checkout event.Examples
Basic Branch Checkout
// Switch to a specific branch
const checkoutResult = await codebolt.git.checkout('test-branch');
console.log('✅ Git checkout result:', checkoutResult);
Checkout at Specific Path
// Checkout branch in repository at specific path
const checkoutResult = await codebolt.git.checkout('feature-branch', '/path/to/repo');
console.log('Checkout result:', checkoutResult);