tags:

views:

624

answers:

2

I think I might be asking something weird/wrong here, but I'm new to git so bear with me!

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?

Thanks

+1  A: 

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

I've answered this here: http://stackoverflow.com/questions/1578694/is-there-a-way-to-make-tortoisesvn-temporarily-ignore-versioned-files/1578737#1578737

(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.)

Ben James
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
A: 

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