And they're usually followed by a hundred of different answers, mostly "you can't" and very complicated ones.
But, in fact, there is a way that's pretty EASY:
- Create your empty directory, let's say it's
temp - Create a
.gitignorefile with this content*inside the directory. - Force add the file to your git repository. You can do that with the
-fflag. - That's all. Yes, no more files inside
tempwill be tracked automatically.
If you're in a command line, it will look like this:
~$ mkdir temp
~$ echo '*' > temp/.gitignore
~$ git add -f temp/.gitignore
Now have fun creating empty directories and track them with git!
No comments:
Post a Comment