I've accidentally committed some files that shouldn't be tracked and should be generated for each developer on their own. I've added a pattern to .gitignore for them, but that's too late of course because the files are already in the repo. I've checked the answers to these questions, but they all say the same thing:
- How to make Git "forget" about a file that was tracked but is now in .gitignore?
- How to stop tracking and ignore changes to a file in Git?
- Remove a folder from git tracking
The command:
git rm --cached <file>
doesn't work because if I commit that, then the other developers will have their versions of the file deleted once they pull.
git update-index --assume-unchanged <file>
..doesn't work either because the files are still being tracked, so if anyone makes changes, they will be committed unless each developer runs the command. Either way, it keeps the files in the repository, which we don't want.
Is there a way to make it as if the files were never in the repository in the first place? I want the same behavior as git rm --cached <file>
without the caveat of it causing the files to be deleted on a pull..