我有一个环境设定档 (.htaccess) 是在 git 的版控之下
因为是环境设定档,所以会依照环境的不同而有所改变或调整,所以我设定了
.gitattributes {.htaccess merge=ours}
目的是为了当环境设定档发生冲突的时候,会以自身设定为主
但现在问题来了,当我 clone 一个储存库下来后
因为我个人的开发环境的关系,我需要调整 .htaccess
调整之后,Git 视为有修改调整,会出现在这次的 commit 里面
而我 push 回 origin 之后,连同 origin 的 .htaccess 里的设定也被改成我个人的设定了
但这不是我想要的结果,我想要的结果是
origin 的 .htaccess 设定保持不变
local 的 .htaccess 为我个人环境的设定
请问我该如何处理?
No one has replied yet, so I’ll answer it myself first
According to the results of my own testing and searching for answers online, there is currently no way to meet the requirements mentioned in my question
But it can be handled like this
1. Remove .htaccess from version control
2. Add .htaccess .gitignore list (no version control required)
3. Get a .htaccess.sample and add it to version control
4. Whenever a new environment is created, copy .htaccess.sample and save it as .htaccess, and adjust it to this Environment settings
This is what we know so far, but I don’t know if there is any other way?