refactor(gitignore): Improve usr directory handling to prevent nested git repositories
Add explicit rules to ignore nested .git directories within usr/ while still allowing .gitkeep files. Restructure usr/** patterns to properly handle directory traversal and prevent accidental commits of nested repositories.
frdel committed
Mar 12, 2026 at 15:03 UTC
07512b3bb873b7a5aaf008914c932c908764fa90
1 file changed
+10
-1
.gitignore
+10
-1
@@ -27,10 +27,19 @@ logs/**
27
# Handle tmp and usr directory
28
tmp/**
29
!tmp/**/
30
+
31
+# hack to keep .gitkeep but ignore nested repos
32
+# Ignore everything under usr
33
usr/**
34
+# Ignore nested repos
35
+/usr/**/.git
36
+# Allow git to traverse directories
37
!usr/**/
38
+# Re-ignore everything again
39
+usr/**/*
40
+# But allow .gitkeep files
41
+!usr/**/.gitkeep
42
33
-# Handle knowledge directory
43
44
# Global rule to include .gitkeep files anywhere
45
!**/.gitkeep