简体   繁体   中英

How to delete all the files marked as not added to git in a folder? (many deleted files reappear after switching branches)

This question says that when you change branches git does not remove existing files, it just adds or updates them as per the overlay mode

https://stackoverflow.com/a/57556730/1058292

If I switch to an old branch and back many files reappear that were once deleted (directories too). My solution is split into the following structure

Solution
___Project1
_____CoreFiles
_____BuildFiles
___Project2
_____CoreFiles
_____BuildFiles

So I just want to delete those files in my CoreFiles directories that are not added to git. I have about 8 project directories and I don't want to delete the build contents. Possibly by deleting those files that are marked as not added in git (red in intellij). Is this possible?

git clean -xdf does it as the response by @0andriy says

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM