Nixius
/
template
Template
2
1
Fork 1
template/.cursor/rules/gitkeep-handling.mdc

48 lines
1.4 KiB
Plaintext

---
description:
globs:
alwaysApply: false
---
# .gitkeep File Handling
## Purpose of .gitkeep
The `.gitkeep` file is a convention (not a Git feature) used to:
- Track otherwise empty directories in Git
- Ensure important directory structures are maintained
- Placeholder for directories that will contain files in the future
## Important Rule
**When adding content to a directory that contains a `.gitkeep` file, you should delete the `.gitkeep` file.**
```bash
# Example workflow when adding content to a previously empty directory
# 1. Check if .gitkeep exists
if [ -f directory/.gitkeep ]; then
# 2. Remove it when adding actual content
rm directory/.gitkeep
fi
# 3. Add your files
touch directory/your-new-file.txt
# 4. Commit both changes together
git add directory/
git commit -m "Add content to directory and remove .gitkeep"
```
## Why Remove .gitkeep?
- `.gitkeep` serves no purpose once a directory contains files
- Leaving it creates confusion about the directory's status
- Proper cleanup maintains a clean repository
## Locations with .gitkeep
In this project, the following locations may contain `.gitkeep` files:
- [temp/.gitkeep](mdc:temp/.gitkeep) - Keeps the temp directory in the repo
- [docker/template/src/.gitkeep](mdc:docker/template/src/.gitkeep) - Keeps the source directory in the repo
Always check for `.gitkeep` when adding files to these directories and remove it if found.