Reputation: 362
We have many developers working on a project in Git. Right now we develop in separate branches and testing is done on these branches. The problem is when we integrate these branches back to master some new issues creep in. Reasons are:
Lately what we have tried:
As soon as a new branch is merged in master we merge it back to individual branches trying to keep the branches as close to master as possible. This minimises but does not solve the issue because of these two reasons -
Its possible that a branch that has caused an issue was actually merged on the last release day or later in the cycle.
The buggy branch since it was merged quite late in the cycle also does not get any coverage in beta testing (master is the beta testing branch).
What best practice do we follow to minimise this problem? I have this solution in mind -
This delays release by the number of days we decide for integration testing but appears to be more disciplined. Since this problem is not new, please give your suggestions or point me to the right ones on the best practices around this.
Upvotes: 0
Views: 153
Reputation: 1266
You could try a completely different approach - adopting a more Continuous Delivery approach means that everyone works on master/trunk, and you utilise Feature Toggles to hide in-progress work from the end users.
This way, you only have small daily merges, rather than big ones (improving point 1), and you also more-or-less solve points 2 and 3.
Upvotes: 2
Reputation: 21
Here is how I would go about doing it:
Test all work done in the developer branch before any merging back to the Project. Merging to the project branch is in two steps:
Step 1 REBASE the developer branch. That is merge the Project branch to the developer branch. Fix any problems and test to ensure no faults have crept in.
Note: The extra testing here helps to pinpoint new problems (introduced through the merge) caused by integrating work from other developers into the current developers branch.
Step 2 If all is OK, merge the developer branch back to the Project branch.
Note: No testing is required here because the Project branch and the Developer branches are identical.
I know this sounds like a lot of extra work, and it also looks like some one has to administer the repository but if you keep at it, it becomes routine and the administration activity falls off. The testing activities also become more routine in that each developer learns the kind of testing required at each step and plans for it.
Good luck with your project! J. Isa
Upvotes: 2
Reputation: 13767
1) Merge conflicts
If at all possible, work on separate files. If it's not, you'll likely have to deal with conflicts. There are some tricks to dealing with them that some devs don't know. For example, say you get a merge conflict on file A. Let's say that you want your version of file A, and not master's (this is very common). Then, you can say git checkout HEAD -- /path/to/fileA
. Then add/commit. This will make git use your changed file as-is, and not master's. Conversely, if you want master's version, you can do git checkout master -- /path/to/fileA
, assuming your local master is up-to-date. Or you can just pick out any file from any branch with this method: it's pretty general and is really convenient at times.
2) In terms of "merge bugs", here's how we handle it:
We use Jenkins/BitBucket as our continuous integration tools, and they seem to work well together. We have a similar development model to yours, we branch right off master and then merge features right back in. However, we don't get these "bugs" from merging, because we force Jenkins to "fake the merge to master", and then run all unit tests on the "fake merge to master" before we're allowed to even merge the pull request into master. This really beats down integration bugs. If you don't have the tools to do this, you have to be really arduous to merge in master and run all your tests before merging. This is a pain in the butt: I suggest making Jenkins or some other automated CI tool do the job for you.
3) Release branches
These can be a good practice. We don't implement them, however. You may find that you turn into a "git secretary" rather quickly by implementing these. We've never actually tried them, so it's hard for me to say whether they're a good idea, but that's the argument I've heard against them from people who have tried them (hearsay, I know).
HTH. Good luck with your release(s).
Upvotes: 1