How can I remove an empty folder locally and also have that happen for other collaborators that share the remote via pull-push? I know that folders aren’t ‘tracked’ in that sense by git but the question remains.
e.g. I moved a file to another folder and committed the change (of the move).
But I can’t git rm name the folder as I get "doesn’t match"
git rmdir name doesn’t exist.
I can do a git clean -f folder but how does that get pushed up?
I can directly rm the file but how do I get that directory removal done correctly and pushed to the repository and then out to others when they pull so that their existing folder gets deleted.
The short answer: You can’t push changes to directories (added, removed, etc.) because Git does not track directories on their own.
According to the FAQ:
So as far as Git is concerned, your empty directory doesn’t exist anymore.
I have found that getting in the habit of using
git clean -fdremoves the need for pushing the removal of directories. However,git cleancan remove items you may not want removed (including any new files you have not yet committed) so I tend to first usegit clean -fdnto see what will be removed if I use the command.It looks like you may be forced to talk to your fellow developers in order to clean up that directory.