method GitOperations.prototype.getCurrentBranch
GitOperations.prototype.getCurrentBranch(): Promise<string>

Get current branch name.

Examples

Example 1

const branch = await git.getCurrentBranch();
if (branch !== "main") {
  console.warn(`Warning: Releasing from branch ${branch}`);
}

Return Type

Promise<string>

Current branch name, defaults to "main" if detection fails

Usage

import { GitOperations } from ".";