8 points · by rufugee · 3y ago · 16 comments
Development happens on short lived branches, gets merged to master via pull request after code review if needed, but at least some automated testing should be done.
NEVER DO MERGE COMMITS: Always rebase + fast forward merging only.
Branches that never reached production and likely never will should be discarded after a while.
Branches that reached production e.g. hotfix branches should be converted to tags after a while.
When looking at history on our main branch, we ALWAYS use `git log --first-parent` which ONLY shows merge commits. Then it shows you exactly what was important (the merge) and in the correct order.
I really wish this was the default view of git log, or really, if git log acted like bzr log that would be even better. It would stop all these arguments about how to have linear history.
Personally I’m a `merge —squash` guy but to each their own
However, `merge --squash` loses its association with that feature branch, which is annoying. You also don't get to see any of the history of what happened in that branch, which can sometimes be really useful if there ends up being a bug that you want to bisect. You don't have any of the original developers individual steps, since it all comes in as a big, unassociated chunk.
An actual "merge commit" should make it easier to revert/reset. I always use merge --no-ff to ensure a merge commit is created. With a merge commit it's clear where the feature branch starts/ends.
I hate git-flow with a passion.
It is all about reducing feedback cycles.
It's rather simple for a new employee to understand, meshes in nicely with CI/CD systems and the release processes of the places I worked at.
Many modern workflows literally have has you prematurely deploying experimental code into production. Hidden behind feature flags. Release branches may not be needed when you do that, but that's a transfer of complexity, not an elimination.
Also the alternatives usually involve a lot of cherry picking. That's nice, but cherry picking requires good understanding of the code to properly do. Complexity moved away from one area into another again.