简体   繁体   English

如何从git存储库中删除或忽略.rb〜文件?

[英]How do I remove or ignore .rb~ files from git repository?

I want to remove/igonre/hide whichever is better .rb~ and .# files such as .#admin.rb.1.2 from the git repository. 我想删除/ igonre /隐藏哪个更好.rb~.#文件,如.#admin.rb.1.2从git仓库。

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: 我还使用为Rails找到的以下值创建了一个.gitignore文件:

.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? 该文件会忽略.rb~备份文件吗? What should I do so that it will remove all the files which match the expression written in .gitignore files? 我应该怎么做才能删除与.gitignore文件中编写的表达式匹配的所有文件?

Files which are already in git will not be ignored anymore. git中已经存在的文件将不再被忽略。 First you have to remove them all and then the .gitignore file is going to ignore the new ones. 首先,您必须全部删除它们,然后.gitignore文件将忽略新的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM