by mseebach · 14y ago · 0 comments
Snark aside,
> Long running branches are bound to happen, [...] Good communication comes in handy here if you are working on long running feature branches.
How about this: Instead of having long running branches, don't have long running branches. Everyone runs on the same master branch, and master is always deployable. This way you don't need to communicate (yes you do, but the sort of communication alluded to is secondary, the full, up-to-date code with tests is the authoritative source). Have features that you can turn on and off in configuration, it's not like having branches ensure that you didn't screw anything up.
We are using perforce, so cross folder integrations are very simple with branch specs.
We'll have one folder named 'staging' where all development happens. Yes, the label isn't quite right. We can deploy this code to a 'staging' environment and test. When we're happy, we can integrate into the production branch and deploy.
These integrations are always one way; they go from staging -> production only. There are no conflicts to deal with. We also get the benefit of cherry picking updates to push in an emergency.
I recently evaluated different CSS-preprocessors for one of our projects. This included not only changing and renaming a bunch of CSS-files, but also adding new dependencies, updating Makefiles, etc. We ended up going with the first one we tried, but it was a tough call so we might've wanted to revert it completely. Isn't this a perfect use case for a branch?
We had previous experience with the preprocessors, but they behaved differently used in our context with modularized CSS, lots of imports, using our custom watch script, etc, so we had to try them out in the actual project.
If everyone works in master, you try it, run the tests, and if they're green, you know it works for everybody. You don't risk breaking feature branch X that did a refactoring in a different direction in an overlapping area.
Of course, this implies that you adhere to a CD/CI philosophy. Code always compiles, all test always pass. If your process involves code being uncompilable, unintegrable or test breaking for substantial periods of time, you'll need branching.