apisurf
Version:
Analyze API surface changes between npm package versions to catch breaking changes
14 lines (13 loc) • 356 B
JavaScript
import { execSync } from 'child_process';
/**
* Gets the current Git branch name.
* Returns 'HEAD' if unable to determine the branch (e.g., in detached HEAD state).
*/
export function getCurrentBranch() {
try {
return execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
}
catch {
return 'HEAD';
}
}