search

Home  >  Q&A  >  body text

eclipse项目里的配置文件应该上传到github上吗?

如题,eclipse项目总是会保存一些配置文件,如.settings文件夹, .classpath/.project文件

现在我想用github和egit帮我个人的项目进行管理...
从代码管理的角度想,这些配置文件好像不需要推送到git...
但是从备份的角度,假如我本地的项目丢失了这些文件,重新配置可能会费不少的功夫

我刚接触git不久,因为没有管理的经验,所以对此很犹豫,希望大家能帮忙想一下,给些建议吧,感谢万分

ringa_leeringa_lee2772 days ago966

reply all(5)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-04-24 16:02:22

    For personal management, it doesn’t matter whether you push it or not. Since you rarely change the configuration file, push 一次和每次都 push there is not much difference.
    But if there is a possibility that other people are involved or you may be in multiple bad situations push 时,push 配置文件会带来不必要的冲突,此时你可以 push 一个基本的配置文件,假设配置文件命名为 config,那么第一次推项目的时候,首先把 config 添加到 gitignore ,然后推一个带有基本配置信息的 config_example 文件,push 结束后,同样把 config_example 添加到 gitignore.
    Now you can assume that I am going to be involved in your project, so I will first clone 你的项目,把 config_example 文件 pull 下来后,我首先复制一份然后重命名为 config,因为文件里面已经有了基本的配置信息,所以我只需稍微改动适应我的开发环境即可,然后我再将两个文件都添加到 gitignore 中,再 push not affect the remote repository.
    This is actually a management method used by our team on our own git server. I think the principles should be similar and I hope it will be helpful to you.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-04-24 16:02:22

    My experience is, don’t do either. If you use maven to manage your code, just leave pom.xml.

    reply
    0
  • 習慣沉默

    習慣沉默2017-04-24 16:02:22

    .gitignore will not be used in detail. As for the configuration files in the project, they will generally tell you whether they should be added to version control. For example, the properties file of this Android project says in the comments:

    This file is automatically generated by Android Tools.
    Do not modify this file -- YOUR CHANGES WILL BE ERASED!
    This file must NOT be checked into Version Control Systems,
    as it contains information specific to your local configuration.

    Must NOT, people have said this, if you still push to the remote git server, your colleagues will strangle you~

    reply
    0
  • 滿天的星座

    滿天的星座2017-04-24 16:02:22

    Don’t upload these files, because they are actually related to the local usage environment, and other people may not use Eclipse. And the information itself has nothing to do with the project. A good approach is to use tools such as maven to manage the project, and then everyone checkout a clean code locally and generate the files needed to import into the IDE.

    reply
    0
  • 某草草

    某草草2017-04-24 16:02:22

    I just saw a blog post a few days ago - Don’t put configuration files in your Git code repository

    reply
    0
  • Cancelreply