Sometimes you want to just have an empty directory in git, but not commit any files in it.
touch data/.gitkeep
And add this to your .gitignore:
data/*
!data/.gitkeep
Then commit. Now you have an "empty" directory.
[#]git #programming
=> More informations about this toot | More toots from ovid@fosstodon.org
@ovid IMHO, a better way is to create a .gitignore file with the following content in an empty directory:
[#] ignore everything except .gitignore
!.gitignore
This technique avoids several disadvantages:
• Both .gitignore and log/.gitkeep must be edited.
• When renaming the directory, it is easy to forget to change the .gitignore file as well.
• .gitkeep is a completely normal file for Git; however, the name suggests that the file would be treated specially by Git.
=> More informations about this toot | More toots from veit@mastodon.social
text/gemini
This content has been proxied by September (3851b).