git: ignoring a file which *is* version controlled

后端 未结 2 1914
星月不相逢
星月不相逢 2021-02-04 04:49

A .gitignore file allows to ignore files from version controlling them at all.

We have a different situation: we want to place in the repository some config

相关标签:
2条回答
  • 2021-02-04 05:37

    I know this kind of dodges the issue, but I would have a ".defaults" file for each, and then change this. This helps with the configuration energy anyway - what if someone who has a custom configuration wants to change the defaults?

    Don't ignore the .defaults, ignore the actual thing. Maybe have a script that copies the .defaults to the regular ones if they don't already exist.

    0 讨论(0)
  • 2021-02-04 05:44

    I define the following aliases in my .gitconfig file:

    [alias]
      ignore = update-index --assume-unchanged
      unignore = update-index --no-assume-unchanged
    

    That should do exactly what you want: running git ignore some-file will treat the file as unchanged no matter what you do to it, until you run git unignore some-file.

    0 讨论(0)
提交回复
热议问题