By doing some pull's,push's,rebase's,merge's...some empty directories left in my project.
Later I came to know, Git doesn't track directories and there is a command to delete such directories.
git clean -fd
This command will clean up all of the files that are not part of your git repository - including the folders.
but above command is also deleting all untracked files and directories,this is a big lose to ongoing development projects.
Is there any way to delete only empty folders with out touching un-tracked files.
It seems easier to delegate that specific task (deleting empty folders) to the shell instead of git:
find . -empty -type d -delete
Get-ChildItem -Recurse . | where { $_.PSISContainer -and @( $_ | Get-ChildItem ).Count -eq 0 } | Remove-Item
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