Git – ignore already existing files.

Problem description

When I started developing in ios, I faced a problem with some of the project files changing each time i run app in debug mode (AppCode). This file is:
It was very irritating that each time, before commit I had to locally revert changes in it.

Not a fix

Simply putting a file name in .gitignore will not work if file is already tracked by Git. This is what manual says about this case.

Actual fix

Git allows to ignore files that were already committed to project in different way.
git update-index --assume-unchanged file_name
After that any local changes in given file will not be seen after you run:
git status.
To revert this and tell Git to tract that file you run:
git update-index --no-assume-unchanged file_name


Git manual about update-index


Jedna uwaga do wpisu “Git – ignore already existing files.


Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:


Komentujesz korzystając z konta Wyloguj /  Zmień )

Zdjęcie na Google+

Komentujesz korzystając z konta Google+. Wyloguj /  Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj /  Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj /  Zmień )


Connecting to %s