const fs = require('fs');
// 获取当前工作目录
let projectRoot=vscode.workspace.workspaceFolders[0].uri.fsPath
// 读取.git/HEAD文件,处理分支信息
fs.readFile(projectRoot+"/.git/HEAD",(err,data)=>{
if (err!=null){
vscode.window.showInformationMessage(err.message);
}else{
// ref: refs/heads/master => master
let currentBranchdata= data.toString().replace("ref: refs/heads/","")
console.log(currentBranchdata) // => master
}
})