0

I have this file that comes with the project, to set up local data that the project needs in order to run.

I committed that file into our git-bitbucket and it generally works but what happens is that when people contribute, the local-config file is also flagged for changes and offered in the commit (where the contributors have to untick that file, otherwise their update will just post local configs that are useless for anyone else)

I tried adding to my .gitignore file the following: config/localenv.csv but I still see changes there being picked up and suggested for commit...

The way I understand it is that: "the file is already tracked and needs to be untracked" - correct?
I've found: git rm --cached public/app/template.js (from .gitignore exclude specific file) - but doesn't that delete the file from the repo?

I don't want to delete the file, I still want contributors to be issues that file that mostly works and serves as a convenient template... I just don't want local changes to be picked up and offered for committing.

Sorry if this is answered a million times, I tried searching and couldn't get it to do what I need :(

DraxDomax
  • 1,008
  • 1
  • 9
  • 28
  • Can this be helpful: https://devconnected.com/how-to-clear-git-cache/ ? – Monsieur Merso Jun 28 '21 at 11:09
  • Does this answer your question? [How to stop tracking and ignore changes to a file in Git?](https://stackoverflow.com/questions/936249/how-to-stop-tracking-and-ignore-changes-to-a-file-in-git) – mnestorov Jun 28 '21 at 11:14
  • https://stackoverflow.com/a/1274447/26414 – Neil Barnwell Jun 28 '21 at 11:22
  • Guys, thanks for the suggestions but all these solutions are for deleting the file from the repo - I don't want that :) "WARNING: While this will not remove the physical file from your local, it will remove the files from other developers machines on next git pull." and "Note that this solution removes the files from the repository, so all developers would need to maintain their own local (non-revision controlled) copies of the file" I don't want that... I want developers to receive a copy of the file from the repo but their changes to the file not offered for comitting – DraxDomax Jun 28 '21 at 11:26
  • A general way is to have a template file versioned (eg : `localenv.csv.sample`), and have everyone run a small setup step after cloning your repo (eg : copy the sample as `localenv.csv` and edit that file). What you *can* do is start by renaming the versioned file to `localenv.csv.sample`. This wouldn't delete it from version, and should correctly try to apply a renaming operation when a user updates his copy of the repo. – LeGEC Jun 28 '21 at 14:38
  • @LeGEC, yeah that's probably the way it will be - thanks! BTW: did you mean that there some standard procedure that git performs for filenames that end with .sample are edited? – DraxDomax Jun 28 '21 at 17:37
  • 1
    @DraxDomax : no, no special treatment by git for `.sample` files. – LeGEC Jun 28 '21 at 18:05

0 Answers0