How to ignore files which are in repository?

后端 未结 4 1280
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 11:04

I have a file (config.php), that is already commited to Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore

4条回答
  •  一生所求
    2020-12-12 12:00

    Once a file is listed in the .gitignore you cannot change it.

    So you could remove the file from the list in one commit, commit changes the next, then re-add the file to the ignore list in a 3rd commit afterwards.

    What I usually do is split the file into two, one that is allowed and I can change, which includes the second file if it exists, then devs can make config changes in the ignored file optionally.

提交回复
热议问题