marmor
marmor

Reputation: 28179

git-flow finish release - selective merge

We've recently started using git-flow in our company, and we've came across the following issue:

We have a DEV_MODE boolean that controls the level of logging in the app, we want the develop branch to always have DEV_MODE=true.
However, when releasing a version we change the DEV_MODE to false.

When I do finish-release in git-flow, it'll merge the DEV_MODE=false into the develop branch.

I there a hook I can use to prevent this, or maybe a way to tell git how to merge files from release branches to develop?

Upvotes: 2

Views: 121

Answers (1)

VonC
VonC

Reputation: 1323263

You can avoid the merge issue entirely by versionning a file "template", with a placeholder value in it:

DEV_MODE=@devmode@

You can then declare a content filter driver (in a .gitattributes file) in order to automatically generate the right content for that file on checkout, depending on the branch currently checked out.

http://git-scm.com/book/en/v2/book/08-customizing-git/images/smudge.png

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

The smudge script can use this to detect the current branch:

#!/bin/sh
branch=$(git rev-parse --symbolic --abbrev-ref HEAD)

Upvotes: 5

Related Questions