.gitignore Isn't the only way to ignore files in Git
Per‑repo vs. user/global ignore mechanisms
- Many commenters highlight
.git/info/excludefor per‑repo, per‑user ignores (e.g., local scripts, Makefiles, sample data, notes) without polluting shared.gitignore. - Global/user‑wide ignores via
~/.config/git/ignore(or equivalent) are emphasized as underused, ideal for OS/editor cruft (e.g.,.DS_Store, IDE folders). - Clarification:
--globalin Git is per‑user; true machine‑wide config is--system(e.g.,/etc/gitignore), which is rarely recommended and can be overridden by user config. - Some tools (Magit) expose a UI to choose between shared
.gitignoreand private.git/info/exclude.
What belongs in .gitignore vs global ignores
- One camp: repo
.gitignoreshould only cover repo‑specific artifacts (build outputs, dependency folders). User‑specific/IDE/OS files belong in each developer’s global ignore. - Another camp: add common OS/IDE junk (e.g.,
.DS_Store,.vscode,.idea) to repo.gitignoreto protect less‑experienced contributors and reduce review friction. - Tension noted: strict “project‑only” policy vs pragmatic prevention of recurring mistakes; concern about
.gitignorefiles accumulating IDE‑ and platform‑specific “cruft.”
Local scratch / “attic” directories
- Several patterns for local junk areas:
- A globally ignored directory name like
attic,aux, orscratch/. - Per‑dir
.gitignorewith*so the directory and all contents (including the ignore file itself) are ignored.
- A globally ignored directory name like
- These are used for personal notes, experiments, or editor/project files that should never be committed.
Git ergonomics, complexity, and discoverability
- Some see the article as a light rehash of the official docs; others say it surfaced features they “always wanted” but never knew existed.
- Git is described both as “beautifully versatile” and as confusing enough that users can’t always predict command effects.
- Discovery is a recurring theme: Git often can do what people want; the hard part is learning the right incantation.
Beyond ignores: related tools and tricks
.gitattributesmentioned for treating some files as “diff‑ignored” (or with custom merge strategies), especially large lock files, though others argue these diffs are important for security and dependency auditing.- Hooks via a global hooks directory can block binary or large files, or enforce policies on lockfiles.
git update-index --assume-unchanged/--skip-worktree(often aliased) are used to locally modify tracked files without showing changes, though they’re easy to forget about.includeIfin Git config allows per‑directory or per‑remote configuration (e.g., different emails per company).