热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何从git存储库中删除或忽略.rb~文件?-HowdoIremoveorignore.rb~filesfromgitrepository?

Iwanttoremoveigonrehidewhicheverisbetter.rb~and.#filessuchas.#admin.rb.1.2fromtheg

I want to remove/igonre/hide whichever is better .rb~ and .# files such as .#admin.rb.1.2 from the git repository.

我想从git存储库中删除/ igonre / hide更好的.rb~和。#文件,例如。#admin.rb.1.2。

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:

我还创建了一个.gitignore文件,其中包含我为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?

这个文件会忽略.rb~备份文件吗?我应该怎么做才能删除与.gitignore文件中写的表达式匹配的所有文件?

1 个解决方案

#1


1  

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.

已经在git中的文件将不再被忽略。首先,您必须将它们全部删除,然后.gitignore文件将忽略新的文件。


推荐阅读
author-avatar
湖黯之殇_257
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有