将 .gitignore 应用于提交的文件 [英] Applying .gitignore to committed files

查看:28
本文介绍了将 .gitignore 应用于提交的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提交了大量文件,现在我想忽略这些文件.我如何告诉 git 现在忽略未来提交中的这些文件?

I have committed loads of files that I now want to ignore. How can I tell git to now ignore these files from future commits?

我也想从存储库中删除它们.它们是在构建之后创建的文件或用于用户特定的工具支持.

I do want to remove them from the repository too. They are files created after ever build or for user-specific tooling support.

推荐答案

  1. 编辑 .gitignore 以匹配您要忽略的文件
  2. git rm --cached/path/to/file
  1. Edit .gitignore to match the file you want to ignore
  2. git rm --cached /path/to/file

另见:

这篇关于将 .gitignore 应用于提交的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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