如何从 git 存储库中删除或忽略 .rb~ 文件?
我想从git 存储库。
我怎样才能做到这一点?
目前我正在按以下方式执行此操作:
git rm -r "/app/models/.#admin.rb.1.2"
将文件一一删除。然后我承诺。
我还创建了一个 .gitignore
文件,其中包含我为 Rails 找到的以下值:
.bundle
db/*.sqlite3*
log/*.log
*.log
/tmp/
doc/
*.swp
*~
.project
.DS_Store
但它并没有忽略目录中已存在的文件。
该文件会忽略.rb~
备份文件吗? 我应该怎么做才能删除所有与 .gitignore
文件中写入的表达式匹配的文件?
I want to remove/igonre/hide whichever is better .rb~
and .#
files such as .#admin.rb.1.2
from the git repository.
How I can do this?
Currently I am doing it in following way:
git rm -r "/app/models/.#admin.rb.1.2"
which removes the files one by one. Then I commit.
I also created a .gitignore
file with the following values which I found for Rails:
.bundle
db/*.sqlite3*
log/*.log
*.log
/tmp/
doc/
*.swp
*~
.project
.DS_Store
But it is not ignoring the files which are already present in the directory.
Will this file ignore .rb~
backup files?
What should I do so that it will remove all the files which match the expression written in .gitignore
files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经存在于 git 中的文件将不再被忽略。首先,您必须将它们全部删除,然后 .gitignore 文件将忽略新的文件。
Files which are already in git will not be ignored anymore. First you have to remove them all and then the .gitignore file is going to ignore the new ones.