0

I need to keep separate configuration.php files locally and on server.

The problem is I've added the file to .gitignore and removed it from index using git rm --cached configuration.php but then when I push it server, it deletes configuration.php from server.

I am not sure how -assume-unchanged works.

What would be the correct solution to this problem?

Lkopo
  • 4,798
  • 8
  • 35
  • 60
  • possible duplicate of [Branching: different config files for release/development](http://stackoverflow.com/questions/9636492/branching-different-config-files-for-release-development) and a bazillion others – user229044 Sep 13 '14 at 18:23
  • @meagar what you suggest is slightly different and not clear enough. I dont want to push config files but if i add them on my local `gitignore`... push deletes config files on server... how to solve that? for all machines? – Gaurav Bora Sep 15 '14 at 12:50

1 Answers1

0

You can use git update-index --assume-unchanged instead of git rm --cached if the configuration.php is not changed and pushed to git server frequently but only different in different clients.

git update-index --assume-unchanged configuration.php

From doc,

This option can be also used as a coarse file-level mechanism to ignore uncommitted changes in tracked files (akin to what .gitignore does for untracked files).

The only problem is that if others push new changes of configuration.php to the git server, you need to manually handle it if you do git pull.

Landys
  • 7,169
  • 3
  • 25
  • 34