List all the git branches
Just return the data and leave it to the consumer what to do with it. That way, branches becomes a generic data grabber. If you want to have printer functions, keep them separate from the raw command.

Your Promise wrapper appears to expect the output of the branches command. Move the use of lines to the branches function instead.

Also, arrow functions with single arguments can omit the parens.

const promiseExec = (cmd) =&gt; new Promise((resolve, reject) =&gt; {
  cp.exec(cmd, (err, stdout, stderr) =&gt; {
    if (err) reject(err);
    else resolve(stdout);
  });
});

const branchLines = (str) =&gt; str.trim().split(os.EOL).map(line =&gt; line.trim().replace(REGEX_STAR, ''));

const branches = () =&gt; promiseExec('git branch -a').then(res =&gt; branchLines(res));

const printBranches = () =&gt; branches().then(res =&gt; console.log(res));

// Print manually
branches().then(res =&gt; console.log(res));

// or have a printer function do it
printbranches();