Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have a script listed in package.json for my site. Often I don't really care about commit messages here, not because I don't find them valuable, but because so often its from editing and publishing articles. I don't really want to think of messages all the time so often end up typing random crap.

I use this now:

    import { execSync } from 'child_process';

    execSync('git add -A');

    const modifiedFiles = execSync('git status --porcelain')
        .toString()
        .trim()
        .split('\n')
        .map((line) => line.replace(/^\s*[MADRCU?!]{1,2}\s+/, ''));

    const fileList = modifiedFiles.join(', ');
    const commitMessage = `Change: ${fileList}`;

    execSync(`git commit -am '${commitMessage}'`);


    
    "changes:summary": "tsx ./tools/changes-summary.ts",


Ooo that's nasty... I love it!

Much better than "Changes", "Update" or "WIP".


This is exactly why I made it, in fact a lot of commits in there are wfwefewf, frefrregre, stuff, wefewfwwefew

Every time I'm tempted to figure out how to squash/collapse the entire history down to a single commit and then always use that script.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: