如何将这些修改后的文件添加到 .gitignore?
How can I add these modified files to .gitignore?
当我执行 git status
时,我看到以下内容:
modified: ../.bundle/binstubs/byebug
modified: ../.bundle/binstubs/coderay
modified: ../.bundle/binstubs/erubis
modified: ../.bundle/binstubs/haml
modified: ../.bundle/binstubs/htmldiff
modified: ../.bundle/binstubs/iron_worker
modified: ../.bundle/binstubs/kramdown
modified: ../.bundle/binstubs/ldiff
我的 .gitignore 包含:
../.bundle/*
但这些文件仍然显示。如何在我键入 git status
时将它们从显示中移除?这些都是珍宝,所以我认为我的存储库中实际上不需要它们。
创建或更改 .gitignore
上一级目录。
将 .bundle
添加到此文件
除了 murraybo 所说的,因为看起来你已经将这些文件添加到你的历史记录中,即使你将它们添加到你的 .gitignore
,git 也会保留跟踪它们(除非从您的历史记录中删除)
要 remove/stop 跟踪它们(不删除本地副本)执行:
git rm --cached -r ../.bundle/
当我执行 git status
时,我看到以下内容:
modified: ../.bundle/binstubs/byebug
modified: ../.bundle/binstubs/coderay
modified: ../.bundle/binstubs/erubis
modified: ../.bundle/binstubs/haml
modified: ../.bundle/binstubs/htmldiff
modified: ../.bundle/binstubs/iron_worker
modified: ../.bundle/binstubs/kramdown
modified: ../.bundle/binstubs/ldiff
我的 .gitignore 包含:
../.bundle/*
但这些文件仍然显示。如何在我键入 git status
时将它们从显示中移除?这些都是珍宝,所以我认为我的存储库中实际上不需要它们。
创建或更改 .gitignore
上一级目录。
将 .bundle
添加到此文件
除了 murraybo 所说的,因为看起来你已经将这些文件添加到你的历史记录中,即使你将它们添加到你的 .gitignore
,git 也会保留跟踪它们(除非从您的历史记录中删除)
要 remove/stop 跟踪它们(不删除本地副本)执行:
git rm --cached -r ../.bundle/