美文网首页
git忽略日志文件(.log文件)

git忽略日志文件(.log文件)

作者: 方_糖 | 来源:发表于2019-11-25 11:09 被阅读0次

git pullgit add .的时候,总会出现一些的文件导致我们不能使用git add .一次性添加所有的修改,或者不能使用git pull origin master来合并远程修改,因为会报错

Your local changes to the following files would be overwritten by merge: xx.log

所以我们该怎么办呢?

解决办法:使用.gitignore文件

1. 创建.gitignore文件文件(前提:没有.gitignore文件)
  • 可以在目录中右键选择git bash Here
  • 使用touch .gitignore命令创建文件'
2.添加你想忽略的文件或文件夹
  • 使用编辑器打开 .gitignore文件


    image.png
  • 使用忽略规则来填写你想忽略的文件

忽略规则
target :忽略这个target目录
angular.json : 忽略这个angular.json文件
log/* : 忽略log下的所有文件
css/*.css : 忽略css目录下的.css文件

例如我想忽略主目录下WEB-INF/log/WebAgenda.log文件

image.png

相关文章

网友评论

      本文标题:git忽略日志文件(.log文件)

      本文链接:https://www.haomeiwen.com/subject/dcydwctx.html