In this tutorial you will learn how to commit an empty directory in Git. In order to do this you will have to make a hack: commit a file located inside of the directory that you want to commit. Most of the time that file name is .gitignore. Remember that Git is a VCS used for tracking files and not directories. The directories are used just to structure the file system.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# Git Commit empty directory mkdir images/upload git status vi images/upload/.gitignore # Ignore everything in this directory * # Except this file !.gitignore git add . git commit -m "Add images upload dir" # Useful links http://stackoverflow.com/questions/115983/how-can-i-add-an-empty-directory-to-a-git-repository |
Useful links:
http://stackoverflow.com/questions/115983/how-can-i-add-an-empty-directory-to-a-git-repository