top | item 41589313

(no title)

zlies | 1 year ago

You should switch the default to not delete any files and modify/remove the files only with some flag (--dry-run=false, --rm, --delete, etc). I just deleted all files accidentally in a monorepo :D Luckily I didn't had any uncommitted changes and could recover using git

discuss

order

jamil7|1 year ago

It's maybe reasonable to change the defaults, but I think you should also be mindful of running any random cli program in your codebase, the top of the Github readme does indicate that the --check mode runs it without deleting files.

richardw|1 year ago

I’d maybe recommend inverting the command so it doesn’t delete by default but only when you add the relevant flag. Far better to add a little rigmarole than deal with a sad person who wiped their code.

zlies|1 year ago

You're totally right. I just quickly scanned the readme and had expected a tool that only check the files. But yes, it's a bad idea in general to run random cli programs without checking them in detail

filleokus|1 year ago

It would be kinda cool to use git status to avoid accidental data loss for tools like this.

I've never interacted with git programatically so I don't know how messy it would be to implement. But for tools that mostly operate on "whole files" rather than lines in files, I guess it shouldn't be that tricky?

umanwizard|1 year ago

It’d be very easy to programmatically check which files in a repo directory are unknown to git. Git status does indeed have a machine-parseable output mode.