this should be simple but i cant find the right anwer I am new to git I added a bunch of new files (not staged) to my git tree i want to just delete them without also deleting the git ignore files in that directory any commands? the
git clean -nd
command tells me it will erase all my .git ignore files as well?
For your case, you could give an exclude parameter:
git clean -nd -e **/.gitignore
However, normally, I think it would be recommended to do either of these instead:
.gitignore
file. If the ignore rules are useful for everyone who uses the repo, then it makes sense to push it to the remote. git clean
will not remove committed files..git/info/exclude
file instead of a .gitignore
file. (This is a recommendation from gitignore documentation)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With