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,這時你想被忽略的文件就被成功忽略了。