git提交代码某些文件不需要提交,如.idea、*/targe/等,所以需要忽略某些文件。
安装.ignore插件,重启IDEA
在项目上右键选择New -- .ignore file -- .gitignore file(Git)
自行选择,Generate
添加想忽略的项目和文件,*为通配符
若已经commit过代码了,则在Terminal里命令三连
git rm -r -f --cache .
git add .
git commit -m "add gitignore"
成功之后可以在Version Control -- Log中看到最新的add gitignore