Something like gitignore but don't git ignore

I want to ignore a file containing database passwords, etc. I asked a friend who installed git if I could do gitignore. He said: "No, because there is already a file with dummy data in the repository, there is another function that you should use, I donโ€™t remember what it is called, google it!"

I tried googleing, but given the information, it's pretty complicated, does anyone know what function it is talking about?

+6
git github
source share
3 answers

You must use the gitattribute filter filter

alt text

Thus:

  • at the โ€œsmudgeโ€ check stage, the script can replace the contents of your file with what you want, first save its original content (that is, assuming that the contents of this file are specific enough to be defined as right content, as the filter driver concerns the contents of the files, not the specific path to the file ).
  • and / or at the commit stage, a โ€œcleanโ€ script can restore the same file to its original content (again, assuming that the modified content is defined enough to be detectable and replaceable)
+8
source share

I think that if you add the file to .git / info / exclude, it will be ignored and this exclusion file will be local in your repository and will not be accessible to other users.

I only study git, so you can check this further.

+6
source share

Here's an alternative to gitignore:

Ignore .gitignore file itself

+2
source share

All Articles