Tag Archive: Git

Ignore modified file from commit

Sometimes you need to change some files, just for your development environment and you don’t want to commit those changes. With Git there a way to fix your problem.

First of all, made all the change you need in the file(s) to ignore then run this command:

1
$ git update-index --assume-unchanged path/to/the/file/to/ignore

and it’s done, now your changes are ignored.

Sure, you can roolback those changes by running the command

1
$ git update-index --no-assume-unchanged path/to/the/file/to/version/again

At any point, if you feel that you lost the count of the untracked files, you can list all the files versioned with the files the that starts with a lowercase letter are ignored from versioning.

1
git ls-files -v

To simplify the output run this command, it will only show the ignored files:

1
git ls-files -v | grep '^[[:lower:]]'