Oren
Oren

Reputation: 1006

branching or other solution for different environments, using Git

I have two environments. My own, where I work, and the customer's site. I'm mostly the only one who is going to touch the code, but I want to use Git altogether.

In my environment I need to change a reference for the C# project.

So, most of the time I'm with my environment doing a lot of good stuff to the code and the project, and having the "wrong" reference. All this good stuff should go also to the customer's environment, except of the reference change.

Any way I can achieve this with branching or otherwise in Git? While asking here specifically about Git/branching, I see I can use conditional references (How to reference different version of dll with MSBuild). But I'm still very curious.

There are plenty workarounds like avoiding committing the reference change. But I have a feeling that when someone points out to the direction I'll say "Ah, how didn't I think of it!".

A lot of thanks in advance, Oren.

Upvotes: 2

Views: 84

Answers (1)

VonC
VonC

Reputation: 1324268

Depending on the extend of the changes you need to do from one environment to the other, you could consider using placeholder value in the files that need to change, in order, on git checkout, to replace those placeholder with the right value.

This is done with a content filter driver declared in a .gitattributes file, and using the smudge script.

enter image description here

(image shown in "Customizing Git - Git Attributes", from "Pro Git book")

Upvotes: 1

Related Questions