0

I have a git repository that has a lot of ignored directories in it. However, when someone new downloads the repository, I want them to have the directory structure just not the files within it.

For example, my structure is

  • Data
    • Folder1
    • ...
    • Folder20

And I currently have a .gitignore with !.gitignore in Data. Is the best to create the structure to have a script in my repository that installs it?

4

3 回答 3

1
  • Provide a script in your repository, like makedirs.sh and instruct the user to run that script after checking out the repository, in the README file. The script should take care to create the necessary structure.
  • Stop ignoring these directories, create a dummy file with a name like .empty or .placeholder or .donotremoveme etc, and add them all — this will ensure the directory structure is kept and checked out because the files are.
于 2013-07-29T09:08:11.623 回答
0

Git can't track empty directory unless it is a gitlink

Please do "touch .fake; i.e dot.fake" an ensure that you don't put this name in .gitignore

于 2013-07-29T09:09:10.317 回答
0

As others have said, you need to put a file into the directory in order for git to track it. But instead of ".fake", why not put a README file in there with a bit of actual documentation about what kinds of files you expect users to create inside the directory. (Since you need to put a file in there, may as well use it for something!)

于 2013-07-29T10:44:51.810 回答