branch
codebolt.git.branch(branchName: string, path: string): Promise<any>
Creates a new branch in the Git repository. Can create branches in the current repository or at a specified path.
Parameters
Name | Type | Description |
---|---|---|
branchName | string | The name of the new branch to create. |
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 branch event.Examples
Basic Branch Creation
// Create a new branch in current repository
const branchResult = await codebolt.git.branch('test-branch');
console.log('✅ Git branch creation result:', branchResult);
Branch Creation at Specific Path
// Create a new branch in repository at specific path
const branchResult = await codebolt.git.branch('feature-branch', '/path/to/repo');
console.log('Branch created:', branchResult);