How to stop observing the changes of a certain file?

7

The scenario is as follows. I work on a project that contains a JSON file with the database configuration. Something like:

{
    "db_config": 
     {
        "conn_string": "server:localhost;user:db-user;password=db-pass"
     }
}

It turns out that I need to change these settings to run the project in my local environment, this is because I use the remote bank on a local server.

The problem is that whenever I change this file with my settings

  • I need to remember not to add it before commit ; or

  • I need to remember to change it before commit ; or

  • I just commit the file and "spoiling" the configuration of all my project colleagues.

  • Placing the file in .gitignore would cause it to be deleted from the remote repository.

    How can I ask to ask GIT to ignore all changes I make to this file? And how can I revert this if I need to change any settings in this file later?

        
    asked by anonymous 30.03.2017 / 18:14

    1 answer

    5

    You can use assume-unchanged for this.

    It would look something like this:

      

    git update-index --assume-unchanged path / file

    And to get back to "obervar", just do this:

      

    git update-index --no-assume-unchanged path / file

        
    30.03.2017 / 18:29