简体   繁体   中英

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.

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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