方法一:命令方法
1.首先在仓库中创建隐藏文件“.gitignore”,选中本地仓库,右击“Git Bash Here”,然后执行如下命令:
touch .gitignore
2.用文本编辑器如editplus或notepad++输入需要忽略的文件或文件名,如下所示:
##ignore this file##
/target/
.classpath
.project
.settings
##filter databfile、sln file##
*.mdb
*.ldb
*.sln
##class file##
*.com
*.class
*.dll
*.exe
*.o
*.so
compression file
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.via
*.tmp
*.err
OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db