Open gloriaJun opened 2 years ago
const proc = require('child_process'); function getGitInfo(cmd) { return proc.execSync(cmd).toString().trim(); } // 현재 브랜치 const branch = getGitInfo("git branch | grep \\* | cut -d ' ' -f2-"); // 마지막 커밋의 Hash const lastCommitLog = getGitInfo( `git log --date=short --pretty=format:'%h%Creset %s (%cd) <%an>%Creset' --abbrev-commit | head -n 1` ); // 마지막 커밋의 날짜 const lastCommitDate = getGitInfo(`git log --date=short --pretty=tformat:%cd -1`); // 마지막 커밋의 Hash const lastCommitHash = getGitInfo(`git log --pretty=tformat:%h -1`); module.exports = { // filename: date + '-' + hash, branch, lastCommitLog, lastCommitDate, lastCommitHash, };