Something like gitignore but not git ignore

后端 未结 3 1806
温柔的废话
温柔的废话 2020-12-20 17:21

I want to ignore a file containing database-passwords and such. I asked a friend who set up the git if I could us gitignore. He said \"no, because there is already a file wi

相关标签:
3条回答
  • 2020-12-20 18:15

    I think that if you add the file to .git/info/exclude that it will ignored, and that this exclude file is local to your repository and will not be available to others.

    I'm only learning git myself, so you may want to check this out further.

    0 讨论(0)
  • 2020-12-20 18:15

    Here's an alternative to gitignore:

    Ignore the .gitignore file itself

    0 讨论(0)
  • 2020-12-20 18:20

    You should use a gitattribute filter driver

    alt text

    That way:

    • on the checkout step, a 'smudge' script can replace the content of your file by whatever you want, saving its original content first (that is, assuming the content of that file is specific enough to be detected as the right content, since a filter driver is about the content of files, not about a specific file pathname).
    • and/or on the commit step, a 'clean' script can restore the same file in its original content (again assuming the modified content is specific enough to be detected and replaced)
    0 讨论(0)
提交回复
热议问题