Git does not show irreproducible directories

The git status command does not show new irreproducible directories, and I cannot add them. git How can this be solved? New and unprocessed files are displayed, the problem is only with new directories.

+6
source share
3 answers

Git cannot add directories to the repository. Only files can be added.

If you want to add a directory, put an empty .gitignore file in it and add it.

+12
source

You should use an empty file called ".keep" or ".gitkeep"

+5
source

An empty file named .gitignore in every empty folder you want to commit might make sense.

Especially if you (in the end) have certain files that you would like to ignore in this particular folder, but not others. .gitkeep and .gitkeep only become useful in that they exist and will not provide any other functions. Ultimately, they will be dead weight .

At least .gitignore in these empty folders may be more useful than the original intention to keep track of the folder.

+4
source

Source: https://habr.com/ru/post/952737/


All Articles