Git code redirect stream? Possible?

Yes, another git flow question .. :(

I know well the "standard" git redirect stream:

  • The developer creates a tracking branch (say, "featureA") from the upstream branch (say, "master")
  • Developer code, commits, pulls with rebase, codes, commits, pulls with rebase, etc.
  • Code is executed, developer squash commits and pushes to master

The problem I am facing is that this leaves no room for code verification before merging with the wizard . Reviewers see changes only when they are on the main computer, so if the developer needs to configure something, there will be many commits for this function on this function. Ideally, there is only one.

A few options that I know will solve this, but are not ideal:

  • Ask the developer to direct the function branch to the remote computer. The problem is that after they are reinstalled from the host, the push should be a strong push, which, although probably safe in this case, is not what I want to be commonplace.
  • Do not rearrange upstream changes to function branches, merge them. With this, I cannot crush the function branch and push the commits back to the main one (right?)
  • Use gerrit / github. I have to guess that there is a way to achieve this in pure git?

Is there a better way?

+4
source share
3 answers

There are some third-party tools that allow a more complex review process. We are currently evaluating a Gerrit based workflow.

One possible Gerrit workflow might look like this:

  • The developer enters the function branch. When it's over, he punctures the function branch and reinstalls it on the current master.
  • Code verification software prohibits direct clicking on the main branch, so the developer then pushes this function (compressed to one commit) into the review system, where it can be viewed. Gerrit transparently processes each view request as a separate branch, which is merged (cherry-pick is also possible, but not by default) when the check is completed.
  • If the change does not pass the code check, the developer can change the commit and push the commit again to the review system. The software recognizes that multiple (modified) commits belong to the same request. When the final scan is completed, only the last commit is merged into the actual branch of the wizard.
    Of course, since each function is just one commit, it is impossible to trace the settings that the developer made during the code check (however, as I understand it, this is really desirable). However, the history of each verification request is managed by Gerrit, so nothing is lost.

We are still evaluating a workflow like this, but we are not using it in production yet. Therefore, I can not make any statements about how this approach really works in a real scenario. My point, however, is that if you are interested in more complex browsing processes with Git, Gerrit might be worth a look.

+2
source

The biggest problem with this workflow is to deflate to one commit. This is a restriction of Gerrit. CodeCollaborator turns around this problem and allows for a few commits that we prefer.

+1
source

All Articles