Home  >  Q&A  >  body text

github - git 如何本地忽略文件,而保留远端的同名文件

同一个项目A,多人合作开发,但是项目A里面有个config.php配置文件,不同成员有各自的数据库环境,如何确保其他成员修改了本地配置文件而不提交,或者提交了但不覆盖远端的config.php?

仅有的幸福仅有的幸福2727 days ago607

reply all(5)I'll reply

  • 为情所困

    为情所困2017-05-02 09:32:06

    Create a config.simple.php file, and then add the config.php file to gitignore, so that after different developers clone the code, they can change config.simple.php to config.php and replace it with their own configuration, like this It will not affect others just because someone changes the configuration

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:32:06

    gitignore

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:32:06

    gitignore file writing rules…

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:32:06

    The topic can be summarized: In a distributed environment, how can files ignored by oneself not affect others
    Using .gitignore files is not satisfactory, because .gitignore files will also be distributed to others along with the warehouse
    It is best to control this file yourself

    Then
    you might as well try: git config --global core.excludesfile $yourfilepath

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-02 09:32:06

    .gitignore

    reply
    0
  • Cancelreply