How do I ignore files locally without changing .gitignore?

Add personal, untracked paths to this repository’s info/exclude file. Its rules stay in your clone and are not committed with the project.

1. Find the exclude file for this repository

Run this from the repository root to resolve the correct path, including repositories using a Git file or linked worktree:

git rev-parse --git-path info/exclude

Open the reported file in your editor; create its parent directory and the file if needed. Preserve existing entries. In an ordinary repository the path is .git/info/exclude.

2. Add personal rules

Append these example rules to the reported exclude file. They ignore directories named local-notes and the root dev.local.json. They use the same syntax as .gitignore.

Shared project rules belong in a committed .gitignore. Personal rules needed across repositories belong in the global ignore file. A worktree may share repository metadata, so this is repository-local rather than a promise of a separate configuration for each worktree.

local-notes/
/dev.local.json

Why is a file ignored by global Git rules?

3. Verify and check tracking status

Create the untracked sample files and inspect the source of their rules:

git check-ignore -v -- local-notes/draft.txt dev.local.json

The output should name info/exclude. If the paths are already tracked, this file cannot hide their modifications. Git’s assume-unchanged and skip-worktree bits are not a general solution; use a committed configuration template and an ignored local copy when appropriate.

How do I ignore files Git already tracks?

For exact behavior and further details, consult the official references: Git documentation · git rev-parse documentation · Git FAQ