DEV Community

Discussion on: Master Git Commands with This Handy Cheat Sheet 📜

Collapse
 
dimitrim profile image
Dimitri Mostrey • Edited

A suggestion: before using git clean -f you may want to run git clean -n as a dry-run and see what git will clean. If you want to include directories:
git clean -d -f to force it
git clean -d -n to have a preview peek to see what the command will actually delete (yes, this is not a typo)

If you want some real fun, run git clean -d -x -f. It will also delete ignored files and directories. So please, don't run this on a production server. You will cry for your mama (who can't fix it for you 😝)

Point being, be very careful with the git command clean.

Collapse
 
angelotheman profile image
Angel Oduro-Temeng Twumasi

What wonderful insights.

Surely such precautions must be taken to ensure that such isn't done on the production server to cause any setbacks.

Thank you 😍