UNPKG

439 BJavaScriptView Raw
1"use strict";
2
3const log = require("npmlog");
4const childProcess = require("@lerna/child-process");
5
6module.exports.getCurrentBranch = getCurrentBranch;
7
8/**
9 * @param {import("@lerna/child-process").ExecOpts} opts
10 */
11function getCurrentBranch(opts) {
12 log.silly("getCurrentBranch");
13
14 const branch = childProcess.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], opts);
15 log.verbose("currentBranch", branch);
16
17 return branch;
18}