Git ignoring my .gitignore Rails project

I'm having trouble deploying due to the Rails' tmp/cache/assets and git folder, not ignoring tmp/* or tmp/ . All my .gitignore :

 *.rbc *.sassc .sass-cache capybara-*.html .rspec /.bundle /vendor/bundle /log/* /tmp/* /db/*.sqlite3 /public/system/* /coverage/ /spec/tmp/* **.orig rerun.txt pickle-email-*.html 

This is taken from the github gitignore repo . What can I do to fix this? I get a lot of errors due to local changes (in the tmp/ folder) on my server, such as error: Your local changes to 'tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705' would be overwritten by merge. Aborting. error: Your local changes to 'tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705' would be overwritten by merge. Aborting. , so I cannot deploy dev to my machine :(

+4
source share
3 answers

Did you add .gitignore after starting the project? If tmp/cache/assets/whatever already existed before you added .gitignore, it will still be in the repo.

  • Try git rm -r tmp && git commit remove the entire tmp from the repo.

  • Try the deployment at this point to see if the deployment works from the well-known state. If it still does not work, you know that there is another problem.

  • If everything works, new changes to tmp will no longer be rolled back.

Also, as @thenetimp points out, your current .gitignore will ignore only /tmp , but not something/tmp . I'm not sure if this is your intention or not.

+8
source

remove the forward slash before /tmp/ , it should be tmp/

+4
source

Take a look at the sample .gitignore file at: https://github.com/github/gitignore/blob/master/Rails.gitignore

I also found a good article at http://www.wrel.de/gitignore-und-was-kommt-rein/ (German)

+1
source

Source: https://habr.com/ru/post/1399630/


All Articles