方式一:使用idea工具
1. 在idea工具中,settings -> plugins 安裝 .ignore 插件
2. 點擊項目 右鍵 new -> .ignore file -> .gitignore file(Git) ,給彈出的頁面 Example user template 打上勾,雙擊可編輯。
再使用idea 工具 提交 git 文件就行。
方式二:在項目下新增.gitignore 文件 ,提交就可以
*.class
# project logs
logs/
out/
bin/
# jrebel
rebel.xml
# Package Files #
*.jar
*.war
*.ear
# maven ignore
target/
*.jar
*.war
*.zip
*.tar
*.tar.gz
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# eclipse ignore
.settings/
.project
.classpath
# idea ignore
.idea/
*.ipr
*.iml
*.iws
# temp ignore
*.log
*.cache
*.diff
*.patch
*.tmp
# system ignore
.DS_Store
Thumbs.db
# node_modules
node_modules
*.versionsBackup
application-local.properties