Is it possible to “refresh” a git repository after updating the gitignore file?
I just added more ignorations(?) to my gitignore and would like to remove stuff already in the repo matching the new file.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The solution mentioned in ".gitignore file not ignoring" is a bit extreme, but should work:
(make sure to commit first your changes you want to keep, to avoid any incident as jball037 comments below.
The
--cachedoption will keep your files untouched on your disk though.)You also have other more fine-grained solution in the blog post "Making Git ignore already-tracked files":
Bassim suggests in his edit:
Files with space in their paths