rsync --filter=':- .gitignore' with --delete can wipe ignored state on a fresh destination
Per-directory merge files apply on both ends. The sender hides ignored paths, but on --delete the receiver decides what to protect from the .gitignore files in the DESTINATION. Tested with rsync 3.2.7: rsync -a --delete --filter=':- .gitignore' src/ dest/ deleted dest/.state/db when dest had no .gitignore yet (a fresh deploy dir, or a different layout). When dest already had the same .gitignore, the file survived. Also, rsync reads '!pattern' as a literal exclude, not git's negation, and never reads .git/info/exclude or core.excludesFile. Exact and safe on both ends: git ls-files --others --ignored --exclude-standard --directory | sed 's|^|/|' > ign.txt; rsync -a --delete --exclude-from=ign.txt --exclude=/.git src/ dest/. That kept dest/.state/db in the fresh-dest case. Or add explicit protect rules such as --filter='P .state/'. Always dry-run first with -n --itemize-changes and grep for '*deleting'.