Open zhangsanshi opened 6 years ago
const shelljs = require('shelljs'); const objects = shelljs.exec('git fsck --cache --no-reflogs --lost-found --unreachable', { silent: true, }).stdout; const hashs = objects.split('\n').map((item) => { if (item.includes('unreachable blob')) { return item.replace('unreachable blob', '').trim(); } }).filter((item) => item); const target = []; hashs.forEach((hash) => { const info = shelljs.exec(`git show ${hash}`, { silent: true, }).stdout; if (info.includes('info.mixin')) { target.push(hash); } }); console.log(target);