1

I have a project, it is deployed on heroku. Now I need to deploy the same project, but with some changes (particularly settings ActionMailer, which are in two different directories).

As a result my second project is a development copy, on which the customer will test the changes. After approval, the changes will be applied on the production server.

I wanted to create two branches, add an exception for certain files and work with it. please tell me how to do this.

1
  • I'm not sure I got your question correctly, but as for what I can understand from the title, I would 1) commit the non-exceptional files 2) stash the uncommitted changes (exceptional files) 3) merge Commented Dec 19, 2013 at 16:23

2 Answers 2

1

It sounds like you want to have different configuration settings on different machines.

Here's what I usually do for configuration files:

  • Assume I want to configure my application with a file called config.json
  • Add config.json to my .gitignore, so it will not be included in the repository
  • Create a configuration file template, e.g. config.json.template with good defaults
  • Add instructions in README.md or some other appropriate place that config.json.template must be copied to config.json and modified appropriately
  • Guard my code so that if config.json is missing somebody logical is notified when the application starts
  • Commit my modified .gitignore, my modified documentation, and my new config.json.template sample file

When you deploy to a new server, simply copy your template and modify. The .gitignore will prevent changes to the config file from being committed, so you should probably be sure to include it as part of your regular backup.

Configuration is data, just like the contents of your database. It should be kept separate from application code.

Sign up to request clarification or add additional context in comments.

Comments

1

You cannot do that, as doing so would completely wreck the concept of completing a merge. Git needs to know/track what commits it has merged into a branch, and "partially" doing that would obviously wreck its ability to know what it has already done.

I would recommend creating a branch and cherry picking the commits which contain the changes you want your client to see while ignoring the rest. Ideally you've made good, logical and contained commits, so this plan of action should work for you.

1 Comment

What do you think about .gitattributes for some files/dirs with flag "merge=ours"?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.