Adding gitignore after multiple commits
I am working in a professional environment for about six weeks now and since the start I have been learning git. There was no version control system what so ever here, so one of my jobs is to change that.
Because every website we use is running on WordPress, I have been putting complete wordpress installations into git. After a while it got annoying because the websites upload files and obviously those aren’t tracked by git.
After finding this I tried it on a completely new website and with minor edits it works perfectly! Now I would really like to use it on all the websites, but I don’t know what will happen if I just put the file in the repo’s. After reading some, git ignores the ignores for files that are already tracked. So I need to delete the files myself, but that is undoable for a whole WordPress installation! Is there a way of not losing my past commit information, but still use the new ignore file?
One Solution collect form web for “Adding gitignore after multiple commits”
git rm --cached <file> will remove the file from the repo but not from the local file system, follow that with
git commit and the file stops being tracked due to your new