Musong
2022-09-16 10:19:43 +08:00
之前写过一个,发送到微信,备份到 notion 。用的
const LOG_SPLIT_SEPARATOR: string = '[ThisIsASeparator,HAHAHA]';
const commandString = await this.gitExec(`git log remotes/origin/master --after "${time}" --author "${author}" --pretty=format:"%an${LOG_SPLIT_SEPARATOR}%s${LOG_SPLIT_SEPARATOR}%cd" --no-merges`);
const logArray = commandString.split('\n').map((element: string) => {
if (!element || !element.length) return null;
const data = element.split(LOG_SPLIT_SEPARATOR);
if (!data || data.length !== 3) return null;
const [name, title, date] = data;
return {name, title, date};
})
拆提交记录,感觉比正则保险点
后来没时间解决多分支提交记录合并问题就丢掉了😅