方式1. 右键文件或者文件夹 git -> Add to .gitignore 即可忽略

你会发现在.git/info/exclude 文件中 出现刚刚添加的忽略文件
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
/data/log/

方式2
1.安装.gitignore插件,点击File->Settings
2.在左侧菜单找到(1)点击Plugins,(2)点击Browse repositories 3.安装插件
3.重启idea
之后在项目中会出现.gitignore文件

增加忽略文件

本文介绍了两种在Git中添加和管理.gitignore文件的方法。方法一是通过右键文件或文件夹选择'Add to .gitignore',这将把忽略的文件添加到.git/info/exclude中。方法二是安装.gitignore插件,通过File->Settings->Plugins安装后,重启IDEA,.gitignore文件会自动出现在项目中。学会正确使用.gitignore文件可以避免不必要的文件被版本控制系统跟踪。
7451

被折叠的 条评论
为什么被折叠?



