1

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.

  1. 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.
  2. git update-index --assume-unchanged theFile. The file will disappear from git 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?

Ringo_D
  • 744
  • 4
  • 17
  • 4
    No, there is no simple way to do this. Those are your options. You should instead read up on [how config files are usually handled in source control](https://stackoverflow.com/questions/6009/how-do-you-deal-with-configuration-files-in-source-control). – Lasse V. Karlsen Jul 25 '17 at 07:30

0 Answers0