Moving away from GitFlow
gamasutra.com
gamasutra.com
This "free" QA testing is NOT free. It is in fact what branching is meant to remove. You don't want to mix your dev's development and integration work, they are completely different processes.
What you need is your QA team(or your devs with their QA hats on) actively merging all "ready" branches into an "integration" branch and testing that. You need people to be able to signal "yeah, my branch is stable enough to be merged for integration testing" or "no, don't merge my broken branch that I'm still working on, you'll just waste your time". Incidentally, that's what a pull request is.
The integration branch is mentioned in gitflow but not really expanded upon. I agree with the author that the way they present master/develop, there's not much benefit to develop. However, you need a branch where you're continuously integrating(cough).
This is "extra work" that you need to do, but there's no way around it. You can "do it for free", essentially forcing every dev to be a QA at the worst possible time, disrupting their own workflow, or you can separate it as its own workflow. Whatever works for your team.
Release branches are where you do integration testing of all the merged features. If you have fixes, you merge them into the release branch. Then, once it's OK'd for release, you merge those patches down to develop. Note that this is also exactly how hotfixes work, as they're just a different type of release.
[0] And yes, you will find bugs in other people's code... I don't think anyone is claiming that source control processes can fix that. And if they are, I will call them a silly goose.
In particular, this rings true to every complex source control process I've used that isn't actually enforced with software:
You could of course say that all of these mistakes are the result of human error, and if the same people just read the documentation and learned from their experiences, everything would be fine. But I have seen these mistakes being made so many times, by otherwise competent developers, that I don't buy this argument. There's a saying I love: "If one person tells you you have a tail, ignore them; if a hundred people tell you that, look behind you". If these mistakes happen over and over again (and I can confirm based on my experience that they do), made by different people in different circumstances, then there's no rational alternative to admitting there has to be something fundamentally flawed about the method being used.
Reviewers are expected to provide whatever type of review the author requests, including manual testing and review of system impacts. Their comments do not require a response from the author, unless they ask questions. It is frowned upon to comment too much on code formatting.
In practice, our developers submit PRs for just about everything. Most PRs are small, and most feedback is addressed. Reviewers are thanked and given kudos for finding issues. Knowledge is shared, and the codebase is improved. I’d estimate that 90% of our bugs are caught in review.
Product quality has improved drastically since we implemented this practice. Developers consistently state that our PR process is their favorite part of the job. They get to share their work, get feedback, and become better developers.
In addition, I shared pre-commit git hooks set up to run a few tools that a) enforced the team's code format and documentation standard; and b) performed static code analysis. This mostly prevented code reviews from devoting time to code format and basic documentation issues.
Do you have standards for those though? Like gofmt, prettier, ide formatting configs, etc? I and many others can be rather ocd about maintaining a consistent code style, although I will admit that it's far too easy to focus on that in code reviews (low-hanging fruit). Which is why it should be automatically enforced by tooling so it isn't a distraction during reviews.
Yes, we try to follow industry standards for code formatting as much as possible, but we also try not to be too picky about formatting if it doesn't meet those standards exactly. Usually authors will make the same formatting mistakes multiple times, so rather than comment on each and every badly formatted line, we try to comment on the type of mistake once and note that there are other instances in the same PR.
I agree that auto-formatting is the way to go. The big thing holding us back from using those tools is that we'd first need to reformat the existing code, otherwise the we'd wind up with a lot of unrelated formatting changes in our PRs (assuming that whole files are formatted when saved, rather than just new lines). Certainly not an impossible feat, just something we haven't done yet.
But between that and the pain of having several long-running parallel dev branches that tend to diverge, cross-pollinate in weird ways, have hard time merging to the production branch, etc, my choice is obvious.
And I don't see how they're any better off all committing to master
eg
> Merge problems become hairier and hairier. With everybody working on a long-lived branch, there will be multiple conflicts once they eventually merge. Large scale refactors are discouraged because they will “break everybody’s branches”.
How is that different if everyone commits to master? As soon soon as someone does a large-scale refactor you'll break everyone's "master" and have merge conflicts. It's no different.
Their real problem is not knowing how to manage a team of developers, making huge PRs etc etc
If you read the article, they suggest strongly that it is hard to get a "correct" code review process (perhaps because it encourages the nitpickers, or perhaps for other reasons).
If you've got a bunch of experienced people spending a year on it that can't solve it, perhaps they just can't solve it.
And at that point: What's the difference between something that's wrong, and something that they can't do right?
Good code review is hard. Catching non petty problems is much harder then lengthy obsessing over function names or 'if' vs '?' or whether slightly more or slightly less abstraction or whether two 6 line long function vs one 12 lines long.
> Code review happens through a small window. When reviewing a PR you only look at the fraction of the code that just changed.
Their complaint is that code review makes it easy to miss deviations from global goals & style, not that they nitpick minor presentation issues.
Although I wonder what sftware they are using that would only show them a small fraction of a change…
I.e. all of the code that changed, which is a fraction of the total codebase.
I think a important context here is that this is engine code (a.k.a. library code).
This isn't a web service or web site where what you ship is hitting end users. The end users of this code produce new products, and the potential issues are a) that the users of the engine (i.e. game studios, internal users of Stingray etc) are being held up in their work, or b) that bugs sneak through to their users (the gamers/end users).
In this context, the idea of a quicker turnaround in exchange for some bugs leaking through is much easier to defend. The studio might want the buggy code faster rather than the fixed code later. This is probably not the case for a system deployed directly to end users.
> Why not just encourage faster reviews and smaller diffs..
That was the motivation of switching to trunk based (i.e. removinbg the incentive and slowness of larger PR's). You can't "encourage" smaller diffs other than having the process inherently do that. It's not "encouraging" to send an email to the team telling them to make smaller diffs.
If you are deploying code multiple times a day then it only results in a bunch of meaningless merge commits
Further, it makes sense to have separate 'feature' branches coming off of develop that can be experimental in nature and scrapped at any time instead of rewinding the develop history to a stable point.
EDIT: I mean to split it up for my colleagues because they are not in primarily code-related functions and don't need to be editing the source.
They have huge organizational problems.
Relevant link, Conway's law
They were a small shop and they are now part of Autodesk. Autodesk is a big shop. Hence problems. Hence article.
Edit: they were a small shop and then were aquired by Autodesk (they have since moved on).
Updated my previous post: should be past tense in both cases.
It's all product specific, naturally, but I've had occasions where isolated multi-month branches made sense... They got rebased before merging, though, so all refactoring and merging pain was taken on the side of the divergent branch and the post-squash post-merge history was really clean. Even major code-base wide refactorings should be trivial to incorporate as long as you're not working at distinct cross-purposes with other people (which is a planning issue).
It sounds like encouraging regular rebasing of diverging branches would be the solution here.
https://www.atlassian.com/git/tutorials/comparing-workflows#...
"After adding a few commits, Mary decides her feature is ready. If her team is using pull requests, this would be an appropriate time to open one asking to merge her feature into develop. Otherwise, she can merge it into her local develop and push it to the central repository..."
We practice "gitflow" at my work, except we deviate from it to fit or workflow better. We have feature/fix branches and a master branch that we all use on our dev machines every day, we never ship our master branch though, we ship versioned releases which get backplate of bug fixes as needed. We have hundreds of clients on their own clusters and we stagger new releases to the clusters in order of customer priority. We try to ensure PRs are well tested before merging, bit of minor issues crop up on master we file a bug and sprint it ensure it is fixed before the next release (and generally by whoever did the initial work that caused the issue).
A consistent history is a must-have with a distributed team, IMO. GitFlow's tooling is nice in that context to enforce consistent operations across environments and teams where not everyone is 100% perfect with Git.
Yowsa! This sounds like developers who get code reviews write bad code…
I haven't had code reviews since, until my new job. Where every PR is supposed to be code reviewed. I really enjoy the idea that someone will find problems in my code and suggest better ways to do it so I can further develop my skills. I also spend lots of time coaching junior developers, and like that I can review their PR's to see if my coaching is helping, or if they still need help with concepts.
Writing solid code bases without code reviews seems like a fantasy. Deferring code reviews until a huge new branch is complete and expecting a busy engineer to review the whole thing, and then suggest improvements, and have the original developer then decide to rewrite the entire branch to incorporate them, also seems like a fantasy.
Gitflow vs trunk-style is a kneecap kind of decision.
Interesting idea to try out for us
It's not about feature flags, it's about shipping constantly and knowing after each step if you've made a mistake or not.
To me personally, this method is a huge pill against headaches.
There's no free lunch, but flags can be a useful tool.
I've been in that multi tenant hell, and concur that it sucks.