DEV Community

Discussion on: 8 underrated git commands every programmer should know (not the usual pull, push, add, commit)

martinhaeusler profile image
Martin Häusler • Edited on

git clean -xdf is a great "sh*t hit the fan" command. It erases each and every file in your git directory which is NOT part of your repository. All additional files, such as the ones listed in your .gitignore, will be removed. It's a useful one when you need a fresh start, usually used in conjunction with git reset --hard. Be careful when you use it in projects where external dependencies are downloaded into your projects folder (looking at you, node_modules!) because you'll have to re-download everything again.

milindsoorya profile image
milindsoorya Author

I guess git clean -xdf is something in the line of "with great power...".😅Thanks for sharing.