0 votes
1 view
in Devops and Agile by (29.3k points)

What are the differences between .gitignore and .gitkeep? Are they the same thing with a different name, or do they both serve a different function? I don't seem to be able to find much documentation on .gitkeep.

1 Answer

0 votes
by (50.2k points)

.gitkeep doesn’t have any documentation because it’s not a feature of git

As per git, it cannot add an empty directory

For more details:https://git.wiki.kernel.org/index.php/Git_FAQ#Can_I_add_empty_directories.3F

So for the one who needs to save an empty file in a directory, git provisioned with an external feature called .gitkeep. 

.gitkeep is used to keep files in the empty directory. There is no special significance to the name it can be called anything.

But there is one more thing which does the same but the people might be confused with it (ie-.gitignore file)  

.gitignore file is used to list files that should be ignored by the git when looking for untracked files.

This means this will help to keep empty files and make them ignore by the git when it searches for untracked files.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...