If I have a directory application in my repository with a single, raw file in it and I run git clean -f , I get the message: Do not delete the application / and the non-screen file is still there.
But if I have an additional, tracked file in the same directory, and I execute the same command, then the file without a trace is deleted successfully.
So my question is: why does Git try to delete the directory if it is empty after cleaning it from raw files?
Below is a script that reproduces the behavior. Thanks in advance.
#!/bin/bash # Create new empty repo mkdir myrepo && cd myrepo git init # Create app directory with main.c mkdir app touch app/main.c # Try to delete main.c with git clean -> Not working git clean -f # Add helper.c to app directory and add to index touch app/helper.c git add app/helper.c # Try to delete main.c with git clean -> Now it working git clean -f
source share