There is a file which was already committed and pushed to the repo.
Now I want it to be ignored after initialization, which means that everyone can fetch this file from remote but local change will be ignored unless ones force-add it again and will not be shown in git status
.
It is just like an untraced file except it can be fetch from remote.
I have had some try to solve it.
git rm --cache theFile
. The file will be removed from repo by this command and can't be fetched any more. So it's NOT the correct answer.git update-index --assume-unchanged theFile
. The file will disappear fromgit status
, which is what I need. But it's a local command. Others should call it manually. Also, the git index will change after some command so ones should call it again. It not quiet fit my demand.
Is there a perfect solution?