I am wondering how to exclude specific files' type in git. For example: I am writing code under a directory using TypeScript. Files are getting rendered to .js extension. I have some other directories with .js files that I would like to commit. But, for example, in folder common
I would like to to have all compiled files excluded from git tracking. I don't wanna to see them in a console.
How can I achieve this goal?
Asked
Active
Viewed 7,207 times
2

krzyhub
- 6,285
- 11
- 42
- 68
-
1Show us what you have tried. Am surprised you have not researched hard enough to read up on [gitignore](https://git-scm.com/docs/gitignore) – t0mm13b May 30 '17 at 16:31
-
2Possible duplicate of [gitignore all files of extension in directory](https://stackoverflow.com/questions/10712555/gitignore-all-files-of-extension-in-directory) – Makoto May 30 '17 at 16:31
-
I have added `*.js` in .gitignore file but still displaing `js` extension file in `git status` comment. Any other solution? Thanks. – Kamlesh Jun 24 '21 at 16:50
1 Answers
2
You can create a .gitignore file at common/.gitignore
and then add this rule, this will omit all .js files within your common directory:
*.js

w5m
- 2,286
- 3
- 34
- 46

hellojebus
- 3,267
- 1
- 21
- 23
-
I have added `*.js` in .gitignore file but still displaing `js` extension file in `git status` comment. Any other solution? Thanks. – Kamlesh Jun 24 '21 at 16:50