1

I have the next files in my local repository:

app.component.js core.component.js core.service.local.js core.service.power.ts

My question is very simple, How can I do to ignore the files with the extension .component.js and .service.local.js and other, I mean any file to end with .Any_String.ext

Carlos Bolivar
  • 307
  • 5
  • 12
  • Possible duplicate of [explain gitignore pattern matching](https://stackoverflow.com/questions/33189437/explain-gitignore-pattern-matching) – Pau Jun 08 '17 at 13:37
  • My two cent about gitignore stuffs ... https://github.com/github/gitignore – sensorario Jun 08 '17 at 14:30
  • 1
    Possible duplicate of [Git ignoring all minified suffixed files](https://stackoverflow.com/questions/25987084/git-ignoring-all-minified-suffixed-files) – random Jun 08 '17 at 14:46

2 Answers2

4

Use a wild character '*'. Example *.component.js

quinz
  • 1,282
  • 4
  • 21
  • 33
  • This is valid for the shown examples, but the question is how to ignore when the last two "words" in the filename are not known. (i.e. ".Any_String.ext" as show at the end of the question) – Dan Lowe Jun 08 '17 at 14:28
0

The easiest way is to add these to your .gitignore file.

use this command to stop tracking the specific file

git rm --cached .

or

In this case you can stop tracking the below file.

git rm --cached public/app/core.service.local.js

or

Add these in your gitignore file. I'm not sure you want to skip all files with *.component.js or just only these 4 files.

app.component.js
core.component.js
core.service.local.js
core.service.power.ts

Or use wildcard representation and make sure you ignore unwanted files only.

danglingpointer
  • 4,708
  • 3
  • 24
  • 42