2

I have a development clone and a live clone of a git repository, pushing from development and pulling to live. I'm having a problem in that configuration files need to be changed once they get to the live working copy. This was all working fine until I changed the structure of one of my configuration files - when I went to pull it down, there were 2 problems:

  1. my configuration file wasn't up-to-date, so the changes couldn't be pulled to that particular file (I was expecting that things would just be merged)
  2. I then tried to git pull again, and saw that everything was up-to-date, when viewing the file showed that it clearly wasn't up-to-date.

There's probably something fundamental I'm not understanding about how git works - is it best to create a live branch for modifying configuration files, then merging after pulling to master, or is there a way around this I'm not seeing?

Kara
  • 6,115
  • 16
  • 50
  • 57
Jasper Tandy
  • 335
  • 2
  • 8

2 Answers2

2

The problem of keeping locally modifiable configuration files in version control is a classic one.

I've answered this here: Is there a way to make TortoiseSVN temporarily ignore versioned files?

(That particular question mentions Subversion, but both problem and solution are not specific to any one VCS. I use the same technique for Git repositories, too.)

Community
  • 1
  • 1
Ben James
  • 121,135
  • 26
  • 193
  • 155
  • That's a cool suggestion - I've gone with creating a branch for local-specific content, then merging into that branch. It's actually much nicer than just trusting the VCS to know what to overwrite. Thanks very much for your response, though :) – Jasper Tandy Nov 14 '09 at 12:56
1

I've worked around this by creating a "live" branch, purely for configuration and things like that. Means that all my configuration can go into there, then I checkout the live branch on the live server and merge changes into it any time I need to set things live. Thinking about it, I should've really done this all along anyway - git forced me to improve the way I do this! Thanks, git.

Jasper Tandy
  • 335
  • 2
  • 8