April 13, 2025

Git: stop tracking previously tracked file

If files were tracked, it is not enough to add them to .gitignore for git status to ignore them.

You must also tell git to remove them from the working tree.

To do so, run:

$ git update-index --skip-worktree file1 file2

Source: https://git-scm.com/docs/git-update-index#_skip_worktree_bit


personal computing command-line interface (cli) gnu linux trisquel shell literacy wiki git

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2025 by yctct is licensed under CC BY-SA 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88