Handling empty folders

suggest change

git does not recognice the concept of folders, it just works with files and their filepaths. This means git does not track empty folders. SVN, however, does. Using git-svn means that, by default, any change you do involving empty folders with git will not be propagated to SVN.

Using the --rmdir flag when issuing a comment corrects this issue, and removes an empty folder in SVN if you locally delete the last file inside it:

git svn dcommit --rmdir

Unfortunately it does not removes existing empty folders: you need to do it manually.

To avoid adding the flag each time you do a dcommit, or to play it safe if you are using a git GUI tool (like SourceTree) you can set this behaviour as default with the command:

git config --global svn.rmdir true

This changes your .gitconfig file and adds these lines:

rmdir = true

To remove all untracked files and folders that should be kept empty for SVN use the git command:

git clean -fd

Please note: the previous command will remove all untracked files and empty folders, even the ones that should be tracked by SVN! If you need to generate againg the empty folders tracked by SVN use the command

git svn mkdirs

In practices this means that if you want to cleanup your workspace from untracked files and folders you should always use both commands to recreate the empty folders tracked by SVN:

git clean -fd && git svn mkdirs

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents