I have an environment configuration file (.htaccess) that is under the version control of git
Because it is an environment configuration file, it will be changed or adjusted according to different environments, so I set it
.gitattributes {.htaccess merge=ours}
The purpose is that when environment configuration files conflict, your own settings will take priority
But now comes the problem. When I clone a repository
Because of my personal development environment, I need to adjust .htaccess
After the adjustment, Git will regard it as a modification and it will appear in In this commit
after I pushed back to origin, the settings in origin's .htaccess were also changed to my personal settings
But this is not the result I want. The result I want is that
origin’s .htaccess settings remain unchanged
local’s .htaccess settings are for my personal environment
How should I deal with it?
漂亮男人2017-05-02 09:44:45
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?