像gitignore,但不是git忽略 [英] Something like gitignore but not git ignore

查看:104
本文介绍了像gitignore,但不是git忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想忽略包含数据库密码等的文件。我问了一个建立git的朋友,如果我能让我们gitignore的话。他说:不,因为存储库中已经有一个带有虚拟数据的文件,还有另外一个应该使用的功能,我不记得它叫什么了,google它!



我试着googleing,但是给出的信息相当棘手,有人知道他在说什么功能吗?

解决方案

您应该使用)。

  • 和/或在提交步骤中,干净'脚本可以恢复其原始内容中的同一文件(再次假定修改的内容是sp足以被检测到并被替换)


  • 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 with dummy data in the repository, there is another function that you should use, I don't remember what it's called, google it!"

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

    解决方案

    You should use a gitattribute filter driver

    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)

    这篇关于像gitignore,但不是git忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆