Skip to content

Instantly share code, notes, and snippets.

@pizofreude
Created April 17, 2025 15:47
Show Gist options
  • Save pizofreude/3a5737557973d5aeb721563309bdbe31 to your computer and use it in GitHub Desktop.
Save pizofreude/3a5737557973d5aeb721563309bdbe31 to your computer and use it in GitHub Desktop.
All things VCS

Keeping Empty Folder

Both .gitkeep and .keep can be used to keep an empty directory in version control. However, the difference lies in how Git handles them.

.gitkeep is a file that tells Git to keep the directory it's in as a versioned entity. When you commit a .gitkeep file to a Git repository, Git will keep the directory it's in, even if it's empty.

.keep is a file that tells Git to keep the directory it's in as a versioned entity, but it's not as widely supported as .gitkeep. While both files achieve the same purpose, some Git versions may not recognize .keep as a valid file for keeping directories.

In general, it's recommended to use .gitkeep instead of .keep to ensure that your empty directories are kept in version control across different Git versions and platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment