0

I have a configuration file. Its configuration is different for production vs development. If my master branch corresponds to production and the dev branch corresponds to development, how can I maintain separate versions of the same file(s) for each branch such that merges do not include those file(s)' changes.

tl;dr: I want to be able to retain different versions of a file in separate branches without merge affecting them.

bill.lee
  • 2,207
  • 1
  • 20
  • 26
  • 3
    I'm not a huge specialist of git but I don't think it's possible as branches usually doesn't have any information tied to them (apart from a commit hash) – Sylvain Nov 12 '17 at 02:24
  • I also don't think this is possible as described. The more common way to do something like this would be to have a both the files checked in and to create a symbolic link (or move the file) with the correct file name post release. Or better yet, have your configuration file except environment parameters and then you can use one config file and just inject the environment parameters appropriate for production or development. – Jeff Richards Nov 12 '17 at 05:14
  • Actually, it's possible and reasonable. Check this [answer](https://stackoverflow.com/a/8014154/5563916) for details. Flagging current question as duplicate, since it doesn't differ from the linked one. – nnovich-OK Nov 12 '17 at 18:54
  • Indeed!, @nnovich-OK!! Thank you... I had given up hope. That question is close enough to mine to be a duplicate. A direct link to the answer (rather than the indirected one) is at https://stackoverflow.com/a/3970442/765032 ... I never even heard about `.gitattributes` before. – bill.lee Nov 14 '17 at 23:28

0 Answers0