It is explained in the first paragraph of the documentation of the gitignore
file:
A gitignore
file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected.
Since git status
reports your file as modified
it means Git already tracks the file (it was added and committed in the past).
In order to force Git forget about it you have to add its removal to the index (the area where Git prepares the next commit) then commit the change:
git rm --cached tst.prop
git commit
However, because you put the file in .git/info/exclude
, in the future Git will remove it only on your local repository. After they pull the latest changes (the removal of the file) from the central repository, your collaborators will have the file as "untracked" and, most probably, they will add it again to the repo.
If you want to make Git ignore the file for everybody that works to the project you have to put it in .gitignore
then add .gitignore
to the repository and commit it. And don't forget to remove the file from the index, as explained above.