Netbeans java 项目的 .gitignore 文件中应该包含什么?
netbeans 中的 java 项目的 .gitignore 文件的内容应该是什么?
What should be the content of the .gitignore file for a java project in netbeans?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有相当多的文件您可能不需要提交到 git 中,因为它们是构建的、由 NB 生成的或包含环境特定信息。
如果你创建一个使用 Ant 作为构建机制的项目,你通常会得到一个看起来像这样的目录树...
在你完成构建之后..将会有几个额外的目录
你可能应该把 build, dist和 nbproject/private 目录(及其子目录)到您的 .gitignore 中。
如果您想要非常积极地排除文件,则可能需要考虑排除 nbproject 中出现的所有文件(除了project.properties 和project.xml)。 nbproject 目录中的其他文件在项目打开时由 NetBeans 重新生成。
There are a fair number of files that you probably do not need to commit into git, since they are built, are generated by NB or contain environment specific information.
If you create a project that uses Ant as the build mechanism, you usually end up with a directory tree that looks like this...
After you do a build.. there will be a couple additional directories
You should probably put the build, dist and nbproject/private directories (and their children) into your .gitignore.
If you want to be very aggressive about excluding files, you may want to consider excluding all the files that appear in nbproject EXCEPT project.properties and project.xml. The other files in the nbproject directory are regenerated by NetBeans when the project is opened.
.gitignore
中不应有特定于 NetBeans 的文件。.gitignore
文件是特定于项目的,但在开发人员之间共享,IOW,其中应该只包含所有使用代码的开发人员(包括使用代码的开发人员)共同的内容OSX、Linux(而不是 Windows)和 Eclipse、IntelliJ 或记事本作为编辑器)并且特定于项目。如果您希望根据您的特定环境忽略某些文件(例如 Windows
Thumbs.db
和desktop
文件或 NeBeansnbproject
目录)您应该在全局忽略列表中执行此操作,而不是在特定于项目的.gitignore
- 如果只是因为这样您就不需要将它们单独添加到每个项目中。如果您要忽略的文件既特定于您的环境又特定于项目,请将它们放入该存储库的
.git/info/exclude
中。There should be no NetBeans-specific files in your
.gitignore
. The.gitignore
file is project-specific but shared between developers, IOW there should only be things in there that are common for all developers working with the code (including ones that use OSX, Linux instead of Windows and Eclipse, IntelliJ or Notepad as editors) and that are specific to the project.If there are some files that you would like to ignore based on your specific environment (like e.g. Windows
Thumbs.db
anddesktop
files or NeBeansnbproject
directories) you should do that in your global ignore list, not in the project-specific.gitignore
– if only because then you don't need to add them to every single of your projects individually.If the files you want to ignore are both specific to your environment and specific to the project, put them into that repository's
.git/info/exclude
.