openmcp-document/scripts/simple-git.mjs

11 lines
302 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import simpleGit from 'simple-git';
const git = simpleGit();
export async function getLatestCommitId() {
// 方法1使用log获取最新commit
const log = await git.log({n: 1});
console.log('Latest commit ID:', log.latest.hash);
}
// 如果需要在模块外调用
await getLatestCommitId();