2017-08-07 651 views

回答

-1

使用此代码:

import * as Git from 'nodegit'; 

let repo: Git.Repository = await Git.Repository.open("path to the repo"); 

let currentBranch: Git.Reference = await repo.getCurrentBranch(); 

let currentBranchName: string = currentBranch.shorthand();