DevOps/Git
.gitkeep 파일로 empty folder를 git하기
iliosncelini
2019. 9. 18. 11:38
https://davidwalsh.name/git-empty-directory
https://medium.com/@kinduff/hey-git-please-keep-those-folders-eb0ed37621c8
There are times when you'd like to track an empty directory within git but there's a problem: git wont allow you to add a directory that doesn't have a file in it. The easy solution is putting an empty stub file within the directory, and the industry standard for that stub file name is .gitkeep.
You can quickly create the file and commit the "empty" directory from command line:
# ignore files in folder foo
foo/*# but keep the folder by keeping .gitkeep file
!foo/.gitkeep
touch foo/.gitkeep #add .gitkeep filegit add . git commit -m "Adding my empty directory"
The problem is simple, the solution is easy, but I wanted to highlight that .gitkeep is the industry standard.