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 5,886 times
1
krzyhub
- 5,701
- 11
- 38
- 66
-
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,228
- 3
- 32
- 44
hellojebus
- 2,897
- 1
- 20
- 21
-
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