search

Home  >  Q&A  >  body text

When using the [checkout .] command in git to abandon modifications, why are the newly created folders and files not deleted?

I wanted to use checkout to abandon the modification, but found that the newly created folder and the contents in the folder were not deleted. .

PHP中文网PHP中文网2782 days ago724

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-02 09:50:23

    Because the newly created folders and files are ‘Untracked files’, you can use git clean -fd if you want to discard them.

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:50:23

    Two methods to obtain the git repository:
    git init and git clone. The newly added files (including folders) after these two commands are not included in the git repository management. At this time, the status of git st is: Untracked files, which is required Only manual git add can be included in the git warehouse, otherwise git will be out of control.
    For such files newly added to the working directory, there is a special command for reverse operation: git clean -fd. You can use man git clean to view command instructions.

    reply
    0
  • Cancelreply