Git: Ignoring Version-Controlled Files

Use git-update-index to temporarily ignore changes to files that are already under version control: git update-index –assume-unchanged <files> To undo that use: git update-index –no-assume-unchanged <files> Also have a look at the skip-worktree and no-skip-worktree options for update-index if you need this to persist past a git-reset

Difference in the paths in .gitignore file?

This depends on the behavior of your shell. Git doesn’t do any work to determine how to expand these. In general, * matches any single file or folder: /a/*/z matches /a/b/z matches /a/c/z doesn’t match /a/b/c/z ** matches any string of folders: /a/**/z matches /a/b/z matches /a/b/c/z matches /a/b/c/d/e/f/g/h/i/z doesn’t match /a/b/c/z/d.pr0n Combine ** with … Read more

Definitive retroactive .gitignore (how to make Git completely/retroactively forget about a file now in .gitignore)

EDIT: I’ve recently found git-filter-repo. It may be a better choice. Perhaps a good idea to investigate the rationale and filter-branch gotchas for yourself, but they wouldn’t have affected my use-case below. This method makes Git completely forget ignored files (past/present/future), but does not delete anything from working directory (even when re-pulled from remote). This … Read more