GitHub 官网样例文件
https://github.com/github/gitignore
https://github.com/github/gitignore/blob/master/Java.gitignore
我在.gitconfig所在的目录下创建一个Java.gitignore(名称和位置随意,这样做主要是查找方便)
在刚刚创建的Java.gitignore文件中写入以下内容:
#官方忽略
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
#新增
.classpath
.project
.settings
target
保存,并关闭。
在.gitconfig文件中加入配置信息:
[core]
excludesfile = C:/Users/Jack/Java.gitignore
配置成功后,eclipse会自动识别
重新启动eclipse,这时你想被忽略的文件就被成功忽略了。
原文:https://www.cnblogs.com/fancyn/p/12551316.html