2

I have a project (web), that interacts heavily with a service layer. The client has different staging servers for the deployment of the project and the service layer, like this:

  • Servers from A0..A9 for developement,
  • Servers from B0..B9 for data migration tests,
  • Servers from C0..C9 for integration test,
  • Servers from D0..D9 for QA,
  • Servers from E0..E9 for production

The WSDLs I'm consuming on the website to interact with the service layer, change from one group of server to the other.

How can I keep different versions of the WSDLs in the different branches using a git workflow with three branches (master, dev, qa)?

jfeston
  • 1,522
  • 1
  • 9
  • 11
  • The same way you keep *anything* different in branches. Naturally? I don't understand your question, it's perfectly natural that branches have different stuff in them. – janos Dec 27 '13 at 19:47
  • Hi @janos : The problem is that I want to track the changes on those WSDLs, and that at some point those branches are going to merge (dev->qa, qa->master). During merge I wouldn't want those WSDLs to conflict, instead I want them to keep 'living' in their branch and track their changes within their branch. Is this more clear? _Sorry my sloppy english_ – jfeston Dec 27 '13 at 20:02
  • Yup, more clear, I think, see my answer ;-) – janos Dec 27 '13 at 20:12

2 Answers2

2

As you explained in your comment, the branches will be merged, and the WSDL files will conflict. When that happens, you have to resolve the conflict by keeping the right version of the WSDL file.

For example, if you are on qa, merging from dev, and there is a conflict on a WSDL file, you can resolve it with:

git checkout HEAD file.wsdl

This will restore the WSDL file as it was before the merge, and you can commit the merge.

However, if there are changes in the WSDL file but there are no conflicts, then git merge will automatically merge them. If that's not what you want, and you really want to preserve the file without merging, then you could merge like this:

git merge dev --no-commit --no-ff
git checkout HEAD file.wsdl
git commit

UPDATE

To make this easier, see the first answer to this other question: Git: ignore some files during a merge (keep some files restricted to one branch)

It offers 3 different solutions, make sure to consider all of them.

Community
  • 1
  • 1
janos
  • 120,954
  • 29
  • 226
  • 236
1

I think branching is the wrong tool to use. Branches are highly useful for (more or less) independent development that needs that take place in parallel and in isolation. Your use case of multiple deployment environments doesn't appear to fit that model. It also doesn't scale very well if you need multiple branches for e.g. releases and always have to create and maintain the deployment-specific child branches.

You would probably be better served by a single branch that defines multiple configurations (either for deployment or building, depending on what consumes the WSDL file).

This assumes that the WSDL file is the only different between the branches, which is the impression I get from the question.

Magnus Bäck
  • 11,381
  • 3
  • 47
  • 59
  • I'm developing on a continuos integration model, so there are no release branches. A checkout from `master` will give you a stable version of the project ready-for-production, a few iterations back in development though. A checkout from `qa` will give you a somewhat stable version of the project with the latest features; and finally a checkout from `dev` branch will give you a fresh copy of the current work from the team. Although the deployment layout is more complicated than this, this represents the three versions of WSDLs I'd like to track on every branch without conflicting between them. – jfeston Dec 27 '13 at 20:46
  • Okay, so you need the branches anyway. That doesn't mean that it isn't a bad idea to branch a single file rather than maintaining multiple files, but it depends on the contents of the files, how tied it is to the deployment environment and to what extent the contents should follow the rest of the code when merging. – Magnus Bäck Dec 27 '13 at 21:44