Git: Ignoring files that are already tracked

In this example a CodeIgniter app, where the database config file was hard-coded and needed to be ignored from the future commits.

The simplest way to deal with that is : git update-index --assume-unchanged method.

Command line:

git update-index --assume-unchanged path/to/file

Confirm it worked

git ls-files -v | grep ^h

Restore git staging

git update-index --no-assume-unchanged path/to/file

Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

Open chat
Powered by