taking files out of git

I am maintaining a project that was done in typescript. All the files - .ts (good!), .js(bad!), .map(bad!) - were put in git.  Putting the .js and .map in gitignore only tells me they are being ignored but are still tracked in git (and they are shown when I attempt to make a commit).  How do I get the .js and .map either out of git, or some way to have them not tracked by git?  Should I delete them from my project - and if so, will the .ts recreate them?

I saw one or two support postings about this, but they were quite old.

4 comments

I had to do them previously using git rm at the command line. Adding them to the ignore doesn't actually remove the files.

1

.gitignore only affects unversioned files (they are not suggested for addition, and can only be added using 'force' option - git add -f).
If you added your files to Git index before specifying them in .gitignore, the only way to get them ignored is removing them from Git (git rm --cached your_file, etc)

1

Thanks, Elena.  What is the difference between a git rm, followed by a commit, and deleting the files through the ide followed by a commit (since typescript generates the .js and .js.map)?

0

No difference - once you perform commit, locally deleted files are removed from Git

0

Please sign in to leave a comment.