GitLab - ignore specific files in target branch

只愿长相守 提交于 2019-12-08 04:03:24

You can simply make sure your config files for dev and master are named differently, with their own history. That way, a merge will never overwrite anything.

You can then version and track:

  • a config.tpl (template file with placeholder values).
  • two config file, one for dev, one for master
  • a script able to take a config file and a template file, and produce the config file (which remains untracked, private)
  • a .gitignore which ignores the resulting generated config file
  • a .gitattribute declaring a smudge content filter (see below)

The generation of the config file is automated through a content filter driver, using a .gitattributes declaration.


(image from "Customizing Git - Git Attributes" from "Pro Git book"))

Once you declare that content filer driver in your local config, it will automatically, on git checkout, generate your config file for you.
See a complete example in "Best practice - Git + Build automation - Keeping configs separate".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!