1

Recently i found gradle is generating version file per project and name has pattern it.

Well on region deployment file might need but locally doesn't make sens to check in git repository.

File Name pattern are something like this

  1. backend/web-version.properties
  2. backend/api/api-version.properties

I would like to ignore all these files from check in who's name ending with xxx-version.properties and from all sub folder and files are already in repository. I tried but didn't succeed.

So I have 2 questions here

  1. What could be git ignore pattern for such files with having particular file name format ?
  2. And How to stop tracking existing or already added file to git repository ?
Viraj
  • 1,360
  • 3
  • 18
  • 38
  • 1
    .gitignore will prevent only untracked files. if you added files already, it will continue to track files. you should check it. – mst Nov 20 '17 at 19:09
  • yes, Files are already added in repository.Oh that's why its tracking files. – Viraj Nov 21 '17 at 04:12

4 Answers4

1

You can also use the ** to match any subdirectories, I think this is what you are looking for.

**/*-version.properties
mst
  • 466
  • 5
  • 17
1

You need to create file named .gitignore in the same level where your .git file exists. Just put **/*-version.properties in this file and git will ignore these files from checking in. You may also want to ignore some other files, like IDE created or build files. I suggest you to look at some resources,

https://www.atlassian.com/git/tutorials/gitignore

How do I ignore files in a directory in Git?

Oguz Ozcan
  • 1,497
  • 13
  • 21
1

If you want to ignore them completely (meaning not track them), you need to remove them first:

git rm **/*-version.properties

Then a simple *-version.properties in a .gitignore file will be enough (no need for **/)

But if you want to track them, but ignore their local modification, then you would need a clean filter driver with a simple git checkout HEAD command.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Are you aware of the ".gitignore" file in git repositories? https://www.atlassian.com/git/tutorials/gitignore

Try one of these: **/*-version.properties or *version.properties or just *.properties

josemartindev
  • 1,413
  • 9
  • 17