I have the following directory structure:
project/
.git/
...
app/
...
config/
initializers/
braintree.rb
environments/
production.rb
.gitattributes
My project uses two main branches, master and staging, each tracking a different remote (production and staging heroku apps).
The idea is that the staging branch moves forward with new features, they get pushed to and tested on the staging remote, then master is fast-forwarded to match staging and pushed to the production remote.
Here's what I want to do: freely merge these two branches while keeping their versions of braintree.rb
and production.rb
separate.
To accomplish this, here is what I put in .gitattributes
(as per the ProGit book):
config/initializers/braintree.rb merge=ours
config/environments/production.rb merge=ours
The file is present in both branches.
The problem I'm encountering is that this doesn't seem to have any effect on anything. Whenever I merge between the two, the files get changed anyway and I have to go change them again.
I have a feeling I'm missing something horribly obvious, but so far it's escaping me. I know that other answers here have involved creating custom merge drivers, but the ProGit book makes no mention of this process and seems to imply that the ours
driver is built in (and I've seen it mentioned in the man pages, so I'm relatively sure it is). The only other thing I can think of is that I've somehow put .gitattributes
in the wrong place or messed up its contents, but I can't find much information on that. I've tried moving it to the same directory as the files, but to no avail.
In case it's of any help, I'm running git version 1.7.2 on OS X. Any help would be much appreciated.