2

So for example we have project on git and one file is responsible for various configurations, everyone must change that file locally to make project build on local machine, but at the same time they want to pull that file when some global configuration is changed.

So currently we memorize our local changes, checkout, pull, reapply changes.

It would be nice if git could handle portion of the file like local specific and ignore that during pull/push merging.

Various configuration files have different comment sections, so if git could check if comment line contains some keywords like this:

##### GIT IGNORE SECTION STARTS, PUT LOCAL CHANGES HERE #####
.. add local changes
##### GIT IGNORE SECTION ENDS #####

or this

/* GIT IGNORE SECTION STARTS */

.. add local changes here

/* GIT IGNORE SECTION ENDS */

so git would just look for keyword "GIT IGNORE SECTION" and ignore all between those tags...

is there something like that already?

pera
  • 882
  • 11
  • 21
  • 5
    Separate the local configuration in a local file. Gitignore this file and make the shared one import it. If no import mechanism is available, design a git hook which insert your local configuration (via sed or whatever) after each pull. – rdupz Jun 01 '16 at 20:18
  • 2
    It seems you can do this: http://stackoverflow.com/questions/16244969/how-to-tell-git-to-ignore-individual-lines-i-e-gitignore-for-specific-lines-of (Ruby on Rails example), but it seems complex and a bit messy to ignore some lines and not others. Could you split your config file in two? One local config that's ignored by git and one that each team member gets? – clarkatron Jun 01 '16 at 20:34

0 Answers0