How can I make git ignore future revisions to a file?

前端 未结 7 1887
盖世英雄少女心
盖世英雄少女心 2020-11-28 18:31

I have created a default version of a file included in a git repository. It\'s important that when someone clones the repository, they get a copy of this file. However, I

7条回答
  •  悲&欢浪女
    2020-11-28 18:47

    Take a look at smudge/clean scripting. This way you can version control the file but when it is checked out, you will "smudge" it by replacing the generic/place-holder data with machine specific data in the file.

    When you commit it, you will "clean" it by replacing the machine specific information with generic or place-holder information.

    Smudge/clean scripts must be deterministic in that applying them multiple times, in different orders will be the equivalent of just running the last one in the sequence.

    The same can be applied with passwords if you need to expose your repository but the contents may contain sensitive information.

提交回复
热议问题