Skip to main content

Stop tracking changes of a file with git

··82 words·1 min

For very rare situations this git command is very handy. I use this on my dotfiles repository on a config file that I don’t need to update recent changes (like htoprc).

Ignore an already tracked file #

$ git update-index --assume-unchanged <filename>

Start tracking again #

$ git update-index --no-assume-unchanged <filename>

Source: https://stackoverflow.com/a/23673910

List untracked files #

To list all files with the assumed-unchanged bit set, run this command.

$ git ls-files -v | grep "^h"
h go.mod
h go.sum

The lowercase h indicates that.