git - exclude files from pushing and pulling -


i have remote repository mirrored development site , downloaded local machine work with. when push changes update site hooks.

update thing need: repository holds whole project working "configuraion.php" development site (working online resource testing); developer can pull roject , change 2 path variables in configuration.php run it; after file should not commited repository , should not overwritten when pulling changes.

but errors pulling repository. have tried:

  • downloaded project
  • git update-index --assume-unchanged configuration.php
  • changed file , @ moment seems ok

but when try pull changes (made others) repository following:

error: local changes following files overwritten merge:     configuration.php please, commit changes or stash them before can merge. aborting 

tried add ".git/info/exclude" no visible effect.

what doing wrong?

could case file configuration.php still being tracked other people? if so, remote repository contain file , when go git pull git try bring file local repository. despite have untracked file, git appears trying bring in remote.

update:

it doesn't make sense in git's model remote file ignored. hence, if insist on maintaining configuration.php file in remote repository, should not using file in local setup. 1 easy workaround keep different local php config file (e.g. configurationlocal.php) , run local testing.

so workflow might this:

  1. git pull obtain latest configuration.php file
  2. copy configuration.php configurationlocal.php
  3. add configurationlocal.php .gitignore file never gets tracked
  4. use configurationlocal.php of unit testing, etc.

during subsequent calls git pull there could conflicts configuration.php, won't matter. in case of conflicts, can accept server's version, , update configurationlocal.php script needed.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -