How to permanently prevent specific part of a file from being committed in git?

后端 未结 6 558
一个人的身影
一个人的身影 2020-12-10 04:07

I have cloned a remote SVN repository with git-svn. I have modified a pom.xml file in this cloned repo in a way that the code compiles. This setup is exclusive for me. Thus

6条回答
  •  臣服心动
    2020-12-10 04:29

    One general way to share this kind of configuration file is :

    1. commit a template file (e.g : pom.xml.template)
    2. ignore the file itself (e.g : add pom.xml to the .gitignore file)
    3. have every user customize this file to suit his needs

    Some ways to implement step 3. are :

    • have the user manually edit copy the template file and edit it
    • have some script, which applies a substitution on the template file and write the output to the expected target

提交回复
热议问题