Git delete new files without a trace

it should be simple, but I can’t find the right responder. I am new to git. I added a bunch of new files (I didn’t put) to the git tree, I want to just delete them, without also deleting git to ignore files in this directory of any commands?

git clean -nd
Team

tells me that it will also delete all my .git ignore files?

+4
source share
2 answers

In your case, you can specify the exclude parameter:

git clean -nd -e **/.gitignore

However, as a rule, I think it would be advisable to do any of these:

  • Commit the file .gitignore. If the rules of ignoring are useful for everyone who uses the repo, then it makes sense to press it on the remote. git cleanwill not delete committed files.
  • , .git/info/exclude .gitignore. ( gitignore)
+2

-f:

git clean -f
+2

Source: https://habr.com/ru/post/1617271/


All Articles