3

Database team is implementing code changes, using Visual Studio SSDT database projects with Git source control. Everyone is pushing to main Release branch with code review (only 5 developers on the team). All the database coworkers are only allowed pushing to different files only (tables, sprocs, functions), etc. The way work is assigned, none of us push or work the same sql file. Eventually all good changes from Release (currently in Work) are merged into Master branch (Production Ready).

Code Review ---> Push to Release Branch (Currently in work during Sprint) ---> Merge to Master Production Ready Branch

(a) What are the negative consequences of utilizing this strategy in Git?

(b) For cleaner history, should everyone Rebase ReleasePublic Remote into ReleaseLocal, or conducting Pull? (Fetch/Merge), I would think Rebase is answer for cleaner history.

Note: I agree, it would be annoying only if we are working on the same file and pushing changes. Alternative Strategy to create different feature branches and then merge into main branch. We are refraining from this strategy since each developer has 10 dba admin related changes a day, creating many branches and merges is time consuming and cumbersome-

https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow

2 Answers 2

5

This is not a "strategy". This is a sure way toward chaos.

The idea behind "trunk branch", which means having one branch for integration, does not mean that everyone should be pushing their changes to this branch directly. It only means that his branch is the place where integration happens.

Why do you even need two branches, Release and Master? What benefit does this bring? Probably just the benefit of confusing git history into an incomprehensible mess so that no one knows what is happening.

Stop this madness!

  • Make each change on its own pull-request branch (call it feature branches if you like).
  • Make sure that these pull-requests are not merged into the main integration branch before the code there goes through some minimal code-review.
  • Restrict from pushing directly to your integration branch.
  • For cleaner history, make sure that the pull-request branch if first rebased on top of integration.
  • Make sure that merges of pull-requests are not fast-forwarded and clearly visible in history.

The above will allow for several benefits,

  • Higher quality and less "human error" mistakes.
  • Learning and teaching each other cool dba tricks (during code reviews).
  • Keeping the integration branch green most of the time (it works!).
  • High trust that you are not shooting yourself in the leg using your process.
  • Way less "oops, I overwrote your change" kind of merges.
  • High trust that new team members are not going to mess things up.
  • Git history that is a thing of beauty and a joy forever.

And more ...

Prettier explanation of the "Feature Branch Workflow" is available on the Atlassian Git website here https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow

5
  • thanks, I sense a lot of emotion behind it with lot of fundamentals/decorum, I just want to see what is wrong with strategy, we have code reviews before pushing into release branch, this will compensate for all the 7 benefits we have above, human error, teaching, green integration brach, writing over, etc.. Jul 30, 2018 at 5:24
  • received a different answer here, stackoverflow.com/questions/51586594/… Jul 30, 2018 at 5:25
  • I think I will conduct your strategy after further research,For cleaner history, (a) should everyone Rebase ReleasePublic Remote into ReleaseLocal, (b) or conducting Pull? (Fetch/Merge), I would think Rebase is answer for cleaner history. Jul 31, 2018 at 5:43
  • @Evgeny I disagree with the PR model for this use case. It is just delaying integration. When a PR is finally ready for merge there will be merge conflicts. This requires the developer to rebase. If it took sometime for the PR to be reviewed, the developer that made the change would most likely have lost context which delays again. Does the PR go under any automated builds? I personally would not want to review a PR that has not go through CI. Developers can work in tandem and rebase. But really it is what works for the team so experiment.
    – Robert
    Aug 5, 2018 at 15:09
  • @Hmm First of all, definitely do CI builds on all PRs. Even more than this, when doing the build - first merge master onto the PR branch on the CI server, and only then do the build. Second, delaying integration is just a policy of the organisation - some orgs leave PRs open for weeks, others leave PRs open for maximum two days and never (ever) more than that. It is just a policy, you decide how you want to do it. Aug 5, 2018 at 20:59
1

I believe there are several anti-patterns in your workflow.

1. Having different developpers pushing to different files to avoid conflicts is to hard of a constraint to be sustainable in the long run.
Consequences:

  • you will not be able to propose coherent tasks to your devs for long
  • there will certainly be complexity in the code introduced merely because of the process and not because of business requirements

2. Late merging to master branch
Consequences:

  • you will discover merge issues, technical and business bugs late
  • chances are you may not be able to keep your schedule

Your development process should be business oriented, not tech oriented. You should ask yourself: How can we bring value to users faster?

The answer to this question is actually the alternative strategy that you talk about! But this cannot be implemented without some change in your workflow and very probably in your organisation.

Also, please note that trunc based development cannot be a standalone thing: it has to be paired with feature toggling.

So this is nothing easy here, and nothing to rollout without a serious methodology.

Bottom line is:

You ask yourself very good questions, and you really should be going forward on this line of thought. However what seems to be ahead of you looks like a team transformation; something to be done with some fire power and / or team mates that are consumed agilists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.