π§Ή Repository Hygiene, Exclusion Cascades & Custom Content Attributes
In professional software development, source repositories must remain clean, lean, and strictly confined to authentic project source files. Every compilation run, IDE launch, dependency installation, and local runtime execution generates transient, machine-specific clutter: compiled binaries (.class, .o), dependency trees (node_modules/, venv/), local configuration secrets (.env), OS metadata (.DS_Store, Thumbs.db), and debug log files. Committing these artifacts inflates the repository's permanent object database, triggers merge conflicts, introduces cross-platform line-ending discrepancies, and exposes production API keys. Git solves this through a multi-tiered exclusion and attribution architecture: Repository-level .gitignore (shared project exclusions committed to source), Local private exclusions via .git/info/exclude (workstation-specific rules), Global exclusions via core.excludesFile (system-wide tool patterns), and .gitattributes (granular per-path policies enforcing end-of-line normalization, diff algorithms, merge strategies, and Git LFS filters).
THE THREE-TIER FILE EXCLUSION ARCHITECTURE:
When Git traverses the Working Directory to identify Untracked files, it evaluates ignore rules
across three distinct configuration layers. Lower levels in the directory tree override higher levels:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TIER 1: SUBDIRECTORY .gitignore FILES (HIGHEST LOCAL PRECEDENCE) β
β β’ Filesystem Location: Any directory within the repository (e.g., src/backend/.gitignore) β
β β’ Scope: Applies to files within that specific subdirectory and its children. β
β β’ Version Controlled : Committed to the repository; shared automatically with ALL developers. β
β β’ Use Case : Module-specific rules (e.g., ignoring build artifacts in src/ui/). β
βββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββ
β (Inherited and overridden by)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TIER 2: ROOT REPOSITORY .gitignore β
β β’ Filesystem Location: The root directory of the repository (./.gitignore). β
β β’ Scope: Applies project-wide across the entire working tree. β
β β’ Version Controlled : YES; committed and tracked in project history. β
β β’ Use Case : Standard dependencies (node_modules/), build output (dist/), .env filesβ
βββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββ
β (Inherited and overridden by)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TIER 3: REPOSITORY-PRIVATE EXCLUDES (.git/info/exclude) β
β β’ Filesystem Location: .git/info/exclude (Local repository metadata directory). β
β β’ Scope: Applies ONLY to this local clone on your machine. β
β β’ Version Controlled : NO; strictly local. NEVER pushed to remotes or shared with teammates. β
β β’ Use Case : Developer-specific scratchpads, local testing databases, private notes.β
βββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββ
β (Inherited and overridden by)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TIER 4: GLOBAL USER-LEVEL EXCLUDES (core.excludesFile) - LOWEST PRECEDENCE β
β β’ Filesystem Location: ~/.config/git/ignore OR configured via core.excludesFile. β
β β’ Scope: Applies to EVERY Git repository on the developer's entire operating system profile. β
β β’ Version Controlled : NO; machine-specific user preference. β
β β’ Use Case : OS clutter (.DS_Store, Thumbs.db), personal editor configurations (.vscode/)β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
.gitignore pattern grammar. Explains leading slashes, wildcards, directory-only matches, trailing slashes, recursive double asterisks (**), and negation caveats (!).
.gitignore GLOB PATTERN GRAMMAR & MATCHING RULES:
1. LEADING SLASH (/) - ROOT ANCHORING:
/build/ β Matches 'build/' directory in the REPOSITORY ROOT only.
Does NOT match 'src/backend/build/'.
build/ β Matches any directory named 'build/' at ANY depth in the project tree.
2. TRAILING SLASH (/) - DIRECTORY CONFINEMENT:
logs/ β Matches any DIRECTORY named 'logs/' (and all files inside it).
Does NOT match a regular file named 'logs'.
logs β Matches BOTH a file named 'logs' AND a directory named 'logs/'.
3. ASTERISKS (*) AND RECURSIVE DOUBLE ASTERISKS (**):
*.log β Matches any file ending in '.log' in the current directory and subdirectories.
doc/**/*.pdf β Matches 'doc/a.pdf', 'doc/slice/b.pdf', and 'doc/ch1/sec2/c.pdf' (infinite depth).
**/temp β Matches any file or directory named 'temp' anywhere in the repository.
4. QUESTION MARK (?) AND CHARACTER RANGES ([]):
temp? β Matches 'temp1', 'tempa', but NOT 'temp10' (exactly one single character).
log-[0-9].txt β Matches 'log-1.txt', 'log-8.txt'; does NOT match 'log-a.txt'.
5. NEGATION MECHANICS (!) AND THE FATAL PARENT DIRECTORY TRAP:
*.log β Ignores all log files.
!important.log β Re-includes (un-ignores) 'important.log'.
β οΈ THE CRITICAL PARENT DIRECTORY NEGATION TRAP:
If a parent directory is excluded, Git STOPS reading and traversing its contents!
You CANNOT re-include a file if its parent directory is excluded:
# BROKEN NEGATION PATTERN:
build/ # Entire directory is skipped; Git never inspects files inside!
!build/api.js # THIS DOES NOT WORK! api.js REMAINS IGNORED!
# CORRECT PRODUCTION PATTERN:
build/* # Ignores all files INSIDE build, but does not exclude the folder itself.
!build/api.js # Successfully re-includes api.js!
.gitignore mistake: adding rules for files already tracked in the index. Demonstrates untracking files without deleting physical disk files using git rm --cached.
# ==============================================================================
# THE COMMITTED FILE PARADOX: WHY .gitignore SEEMINGLY "IGNORES" YOUR RULES
# ==============================================================================
# CORE LAW: .gitignore applies STRICTLY to UNTRACKED files!
# If a file is already committed or staged in the index, adding it to .gitignore
# has ZERO effect. Git continues tracking modifications to that file!
# Scenario: Developer accidentally committed '.env' containing API keys previously.
# They add '.env' to .gitignore, edit an API key, and 'git status' STILL shows:
# modified: .env <-- Git refuses to ignore it!
# ==============================================================================
# REMEDIATION WORKFLOW: UNTRACKING WITHOUT DELETING PHYSICAL DISK FILES
# ==============================================================================
# Step 1: Remove the specific file from the Staging Index (Tree 2) ONLY
# Flag '--cached' deletes the file from Git's tracking, but leaves your disk untouched!
$ git rm --cached .env
# Verify working directory: The physical '.env' file remains safely on disk!
$ ls -la .env
# Output: -rw-r--r-- 1 aarav staff 142 Nov 5 12:00 .env
# Step 2: Commit the untracking action
$ git commit -m "chore: stop tracking local environment configuration file"
# Step 3: Verify git status: The file is now properly ignored by .gitignore!
$ git status
# Output: nothing to commit, working tree clean
# ==============================================================================
# MASS RE-INDEXING (PURGING ENTIRE REPOSITORY TRACKING CACHE):
# Use when a major .gitignore update was introduced across thousands of files:
# ==============================================================================
# 1. Stage deletion of all cached index entries:
$ git rm -r --cached .
# 2. Re-stage all files (Git re-reads .gitignore and ignores all matched patterns):
$ git add .
# 3. Commit the cleaned index:
$ git commit -m "chore: purge repository index and enforce updated .gitignore"
git check-ignore with verbose debugging flags to determine the exact file and line number causing an asset to be ignored or unexpectedly tracked.
# ==============================================================================
# DEBUGGING IGNORE CONFLICTS VIA git check-ignore
# When a critical file is unexpectedly ignored, or an ignore rule fails to trigger:
# ==============================================================================
# Problem: You create 'src/data/config.json', run 'git add', and Git warns:
# "The following paths are ignored by one of your .gitignore files..."
# Diagnostic Command: -v (--verbose) outputs Source File, Line Number, and Pattern!
$ git check-ignore -v src/data/config.json
# SAMPLE OUTPUT:
# .gitignore:14:*.json src/data/config.json
# β β β β
# β β β βββ Target file queried
# β β βββ Pattern matched
# β βββ Line number inside the file
# βββ Source ignore file that caused the exclusion!
# ==============================================================================
# ADVANCED DIAGNOSTIC SCENARIOS:
# ==============================================================================
# 1. Tracing why a file is NOT ignored when you think it should be:
# Pass flag '-n' (--non-matching) to view evaluated patterns that failed to match:
$ git check-ignore -v -n debug.log
# 2. Testing multiple files or wildcards simultaneously:
$ git check-ignore -v build/* src/temp/* config/*.yaml
# 3. Forcing a file into the index despite ignore rules:
# Flag '-f' (--force) overrides all .gitignore rules and stages the file anyway:
$ git add -f src/data/config.json
# (Warning: The file is now tracked; subsequent changes will be monitored by Git!)
.gitignore manifest for enterprise full-stack development. Covers Node.js, Python, Java, Docker, environment secrets, OS artifacts, and build outputs.
# ==============================================================================
# ENTERPRISE FULL-STACK .gitignore MANIFEST
# Project: Nikita Infotech Core Engineering Platform
# ==============================================================================
# 1. SECURITY & CREDENTIALS (ZERO TOLERANCE: NEVER COMMIT)
*.env
*.env.*
!.env.example # Retain template structure without secrets
*.pem
*.key
*.p12
*.pfx
secrets/
credentials.json
id_rsa*
id_ed25519*
# 2. RUNTIME DEPENDENCY DIRECTORIES
node_modules/
jspm_packages/
venv/
.venv/
env/
__pycache__/
*.py[cod]
vendor/ # PHP Composer dependencies
target/ # Java Maven build directory
.gradle/ # Gradle cache
# 3. COMPILATION ARTIFACTS & BUILD DISTRIBUTIONS
dist/
build/
out/
bin/
*.class
*.jar
*.war
*.o
*.so
*.dylib
*.dll
*.exe
# 4. LOGS, CRASH DUMPS & DIAGNOSTIC TELEMETRY
*.log
logs/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
core
*.dump
# 5. TESTING, COVERAGE & TEMPORARY RUNTIME STATE
.nyc_output/
coverage/
.coverage
htmlcov/
.pytest_cache/
.tox/
# 6. LOCAL CONTAINER & INFRASTRUCTURE ARTIFACTS
.terraform/
*.tfstate
*.tfstate.*
.vagrant/
# 7. EXPLICIT EXCEPTIONS (PRESERVE EMPTY FOLDERS VIA .gitkeep)
!.gitkeep
.gitattributes. Explains how Git applies path-specific attributes to enforce deterministic end-of-line (EOL) conversions, prevent binary asset line corruption, and override default diff and merge behaviors.
THE .gitattributes ARCHITECTURAL SPECIFICATION:
While .gitignore determines WHETHER a file is tracked, .gitattributes determines
HOW Git treats, filters, diffs, merges, and checks out files once they ARE tracked.
ROOT .gitattributes SPECIFICATION MATRIX:
βββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ATTRIBUTE DIRECTIVE β OPERATIONAL IMPACT ON REPOSITORY β
βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β * text=auto β Git auto-detects text vs binary. Normalizes line β
β β endings to LF in the object store; converts on checkoutβ
βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β *.sh text eol=lf β Forces LF line endings on BOTH repository and checkout β
β β even on Windows! Prevents Linux /bin/bash^M errors. β
βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β *.bat text eol=crlf β Forces CRLF line endings on checkout across all OSs. β
βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β *.png binary β Disables text conversion; treats file as raw binary. β
β β Prevents Git from corrupting images by modifying \r\n! β
βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β package-lock.json -diff β Suppresses generation of massive multi-thousand-line β
β β diffs in pull requests, reducing code review noise. β
βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β *.min.js binary β Treats minified JavaScript bundles as binary files; β
β β suppresses diff noise and merge conflicts. β
βββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PRODUCTION .gitattributes TEMPLATE:
# Set default behavior: auto-normalize text files to LF:
* text=auto
# Enforce Unix LF on shell scripts and source code:
*.sh text eol=lf
*.py text eol=lf
*.js text eol=lf
*.ts text eol=lf
*.html text eol=lf
*.css text eol=lf
# Enforce Windows CRLF on batch scripts:
*.bat text eol=crlf
*.cmd text eol=crlf
# Binary file protections:
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.pdf binary
*.zip binary
*.tar.gz binary
.gitattributes routes large files to Git Large File Storage (Git LFS) and illustrates the execution pipeline of custom smudge (checkout) and clean (commit) content filters.
THE SMUDGE AND CLEAN FILTER PIPELINE ARCHITECTURE:
Git allows transforming file content dynamically as it transitions between the
Working Directory (disk) and the Object Store (repository database):
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β WORKING DIRECTORY (LOCAL DISK) β
β (e.g., 500MB video or unmasked secret) β
βββββββββββββββββ²ββββββββββββββββββ¬ββββββββββββββββ
β β
SMUDGE β β CLEAN
FILTER β β FILTER
(On checkout) β (On git add)
β β
β βΌ
βββββββββββββββββ΄ββββββββββββββββββββββββββββββββββ
β STAGING AREA / REPOSITORY β
β (e.g., 130-byte LFS pointer or masked) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
1. GIT LARGE FILE STORAGE (LFS) VIA .gitattributes:
When Git LFS is configured for large binaries (video, 3D models, ML datasets):
# .gitattributes entry:
*.psd filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
β’ CLEAN FILTER (git add): The LFS clean filter intercepts the 500MB MP4 file, uploads it to an
external LFS server, and writes a tiny 130-byte plaintext POINTER into Git's object store!
β’ SMUDGE FILTER (git checkout): Downloads the real 500MB asset from the LFS server and replaces
the pointer file in the working directory transparently.
SAMPLE LFS POINTER STORED IN GIT OBJECT STORE:
version https://git-lfs.github.com/spec/v1
oid sha256:3b4e3e533604c5a9f0d8c5708c5ae48b8846f7eaee8fb117ad06bdd830b7586c
size 524288000
.gitignore rules intercept sensitive files, checks for tracked secret extensions (.env, .pem), and flags missing .gitattributes.
import subprocess
import os
import sys
from typing import List, Dict, Any
class RepoHygieneAuditor:
"""
Automated Repository Hygiene & Exclusion Auditor:
1. Audits tracked files to ensure no sensitive files (.env, .pem, .key) bypass .gitignore.
2. Validates presence and baseline rules in .gitignore and .gitattributes.
3. Identifies untracked junk files in the working directory.
"""
SENSITIVE_PATTERNS = [".env", ".pem", ".key", "id_rsa", "credentials.json", ".pfx"]
def __init__(self, repo_path: str = "."):
self.repo_path = os.path.abspath(repo_path)
self.violations = []
def _run_git(self, args: List[str]) -> str:
try:
res = subprocess.run(
["git"] + args,
cwd=self.repo_path,
capture_output=True,
text=True,
check=True
)
return res.stdout.strip()
except subprocess.CalledProcessError:
return ""
def audit_tracked_secrets(self):
"""Scans all files currently tracked in the Git Index for secret patterns."""
tracked_files = self._run_git(["ls-files"]).splitlines()
for f in tracked_files:
for pattern in self.SENSITIVE_PATTERNS:
if pattern in os.path.basename(f):
self.violations.append({
"category": "CRITICAL_TRACKED_SECRET",
"file": f,
"description": f"Sensitive file matches secret pattern '{pattern}' and is ACTIVELY TRACKED in Git!"
})
def audit_gitattributes(self):
"""Verifies presence of .gitattributes for EOL normalization."""
attr_path = os.path.join(self.repo_path, ".gitattributes")
if not os.path.exists(attr_path):
self.violations.append({
"category": "MISSING_GITATTRIBUTES",
"file": ".gitattributes",
"description": "Missing .gitattributes file; line endings and binary protections not enforced."
})
def audit_gitignore(self):
"""Verifies presence and minimum baseline rules in .gitignore."""
ignore_path = os.path.join(self.repo_path, ".gitignore")
if not os.path.exists(ignore_path):
self.violations.append({
"category": "MISSING_GITIGNORE",
"file": ".gitignore",
"description": "Root .gitignore file is completely missing!"
})
else:
with open(ignore_path, "r", errors="ignore") as f:
content = f.read()
if ".env" not in content:
self.violations.append({
"category": "WEAK_GITIGNORE_RULE",
"file": ".gitignore",
"description": ".gitignore does not contain explicit rules to block '.env' files!"
})
def run_full_audit(self) -> Dict[str, Any]:
self.audit_tracked_secrets()
self.audit_gitattributes()
self.audit_gitignore()
return {
"repository": self.repo_path,
"passed": len(self.violations) == 0,
"total_violations": len(self.violations),
"violations": self.violations
}
if __name__ == "__main__":
print("==========================================================================")
print(" REPOSITORY HYGIENE & EXCLUSION COMPLIANCE AUDITOR")
print("==========================================================================")
auditor = RepoHygieneAuditor()
# Simulated audit run for academic curriculum demonstration
mock_violations = [
{
"category": "CRITICAL_TRACKED_SECRET",
"file": "config/production.env",
"description": "Sensitive file matches secret pattern '.env' and is ACTIVELY TRACKED in Git!"
},
{
"category": "MISSING_GITATTRIBUTES",
"file": ".gitattributes",
"description": "Missing .gitattributes file; line endings and binary protections not enforced."
}
]
print(f"[*] Scanning repository root: {os.getcwd()}...")
print(f"[!] Compliance Deficiencies Identified: {len(mock_violations)}\n")
for idx, v in enumerate(mock_violations, 1):
print(f"Violation #{idx}: [{v['category']}]")
print(f" βββ Target File : {v['file']}")
print(f" βββ Risk Detail : {v['description']}\n")
print("[β] AUDIT RESULT: FAILED. Remediate tracked secrets before pushing to remote.")
.gitkeep.
EXCLUSION DEFECTS & DIAGNOSTIC REMEDIATION:
// ==============================================================================
// PITFALL 1: COMMITTED SENSITIVE FILE LEAKED IN GIT HISTORY
// MISTAKE: Developer ran 'git rm --cached .env', committed, and pushed.
// FALSE SENSE OF SECURITY: The '.env' file is untracked on the current branch,
// but the historical commit still contains the plaintext database password!
// Any clone can run 'git show <old_commit>:.env' and read the secret!
// REMEDIATION: Historical Purge Protocol:
// 1. Immediately rotate the leaked API keys / database credentials at the provider!
// 2. Use 'git-filter-repo' to purge the file permanently from all historical commits:
// $ pip install git-filter-repo
// $ git filter-repo --invert-paths --path .env
// 3. Force-push the rewritten history: $ git push origin --force --all
// ==============================================================================
// ==============================================================================
// PITFALL 2: TRACKING EMPTY DIRECTORIES (THE .gitkeep CONVENTION)
// PROBLEM: Git tracks CONTENT (Blobs) and TREES that contain blobs. Git CANNOT
// track an empty directory by design!
// If you create 'logs/' or 'uploads/' as empty folders, Git will not commit them.
// REMEDIATION: The .gitkeep / .gitignore Convention:
// Place an empty hidden file named '.gitkeep' or a nested '.gitignore' inside:
// $ mkdir -p uploads && touch uploads/.gitkeep
// $ git add uploads/.gitkeep && git commit -m "chore: retain uploads directory"
// Or ignore all files inside while retaining the directory:
// # uploads/.gitignore
// *
// !.gitignore
// ==============================================================================
// ==============================================================================
// PITFALL 3: ACCIDENTAL LINE-ENDING CONVERSION CORRUPTING IMAGES
// SYMPTOM: An engineer adds '* text' to .gitattributes. A newly added PNG image
// is corrupted and will no longer open!
// CAUSE: Git treated the raw binary bytes as text and altered 0x0D 0x0A (CRLF) to 0x0A (LF).
// REMEDIATION:
// 1. Mark image extensions explicitly as binary in .gitattributes:
// *.png binary
// *.jpg binary
// 2. Renormalize the file:
// $ git checkout HEAD -- my_image.png
// ==============================================================================
FILE EXCLUSION & ATTRIBUTES SPECIFICATION MATRIX:
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β MECHANISM / CONFIG β FILESYSTEM LOCATION β SCOPE / TRACKING β CORE OPERATIONAL ROLE β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Root .gitignore β Repository root directory β Project-wide / β Team-wide shared exclusions β
β β (./.gitignore) β Tracked in Git β for dependencies & artifacts β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Subfolder .gitignore β Any subdirectory β Local Subtree / β Granular, module-specific β
β β (e.g., src/ui/.gitignore) β Tracked in Git β ignore pattern overrides β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Private Excludes β .git/info/exclude β Local Clone / β Developer private rules; β
β β (Inside .git metadata) β NOT Tracked β never pushed to remote serversβ
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Global Excludes File β ~/.config/git/ignore β All Repositories β OS-level clutter (.DS_Store) β
β (core.excludesFile) β Configured in ~/.gitconfig β NOT Tracked β and personal IDE settings β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Diagnostic Tracing β CLI: git check-ignore -v β Dynamic Runtime β Prints source file and line β
β (check-ignore) β target/file.path β Audit β causing file to be ignored β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Untracking Cache β CLI: git rm --cached β Staging Index β Removes file from Git trackingβ
β (git rm --cached) β target/file.path β Modification β while preserving file on disk β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββββββββββββββ€
β Custom Path Attributes β .gitattributes β Project-wide / β Enforces LF line endings, β
β (.gitattributes) β Repository root directory β Tracked in Git β binary flags & Git LFS filtersβ
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββββββββ€
β TOP 5 FILE EXCLUSION & ATTRIBUTES COMMANDMENTS: β
β 1. Never Commit OS Clutter to Project .gitignore: Place .DS_Store and Thumbs.db in global excludes. β
β 2. .gitignore Cannot Ignore Tracked Files: Untrack pre-existing files first via 'git rm --cached'. β
β 3. Never Ignore the Parent Directory If Negating: Use 'dir/*' instead of 'dir/' when re-including. β
β 4. Enforce LF via .gitattributes: Protect cross-platform builds by defining '* text=auto eol=lf'. β
β 5. Mark Binaries Explicitly: Prevent CRLF corruption by applying the 'binary' attribute to media. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ