Question

I am using Visual Studio 2013 and GitHub for my source control, and a problem I keep having is that it keeps trying to commit all of the .js files that are generated from .ts (Typescript) files.

The reason this is bad is because I've had experiences where committing these causes building to fail, and only closing and re-opening Visual Studio fixes the issues.

My knowledge of git is still rudimentary in general, but it seems to me this must be a common problem. I do not want to just exclude all .js files because there are many that are not generated from typescript; So is there anything I can do about this other than MANUALLY excluding the files every single time I do a commit?

Was it helpful?

Solution

Add some file patterns to one of Git's ignore files.

  • The .gitignore file is usually committed with the repository, so its ignores are shared by all users.
  • The .git/info/exclude file is not committed with the repository, so it can be used for your own personal ignores.

To ignore all .js file in a directory foo, use something like this:

foo/*.js

Note that patterns in the ignore files only prevent files from being tracked. This means that if you have already committed a file, it will continue to be tracked. Modifications will cause the file to show up in your "uncommitted changes", and something like git commit -a will cause changes to be committed.

If you have a committed file that you wish to ignore going forward, you will have to remove it from the repository. This is a frequent question on SO, and there are many questions about handling this.

It is worthwhile to read up on Git's ignore feature, as it has a few gotchas.

OTHER TIPS

There is this feature request : http://github.com/TypeStrong/atom-typescript/issues/253

For now, I used

  • rename file, ex, myfile.ts.ts
  • include in .gitignore my auto-generated typescript *.ts.js and *.ts.js.map
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top