如何在git仓库中递归地忽略所有隐藏的目录/文件? [英] How to ignore all hidden directories/files recursively in a git repository?

查看:366
本文介绍了如何在git仓库中递归地忽略所有隐藏的目录/文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让Git忽略所有隐藏的文件和目录. 即

I'd like to have Git ignore all hidden files and directories. i.e.

  • .aptitude
  • .ssh/
  • .bash_rc
  • config/.hidden
  • .aptitude
  • .ssh/
  • .bash_rc
  • config/.hidden

是否有一条简单的规则来涵盖这一点,而无需专门添加每个条目?

Is there a simple rule to cover this without specifically adding each entry?

推荐答案

只需将模式添加到.gitignore

.*
!/.gitignore

:添加了.gitignore文件本身(如果尚未提交,则存在一些问题).

Added the .gitignore file itself (matters if it is not yet commited).

这篇关于如何在git仓库中递归地忽略所有隐藏的目录/文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆