Xaree Lee
Xaree Lee

Reputation: 3397

Force to atomically rebase and non-fast-forward merge using Gerrit/GitLab

We are deciding to use Gerrit or GitLab for code review.

And here is our commit history guide:

The git graph is like this:

enter image description here

We can read the tasks easily.

If We Using Gerrit

There is a rebase button and merge always (merge --no-ff) in the project settings, but I don't know how to make the rebase and merge --no-ff always be ATOMIC operation by Gerrit.

It means that, when I submit to merge into the main branch, no one can submit another merge before my two step git operations are done (rebase and merge --no-ff).

If it is not atomic, then after I rebase my branch to the latest commit of the main branch (HEAD) and just before I merge into main branch, someone could submit a merge and it will change the HEAD.

The git graph will be just like this (two non-fast-forward merges from the same commit):

enter image description here

Is there any way to force to atomically rebase and non-fast-forward merge using Gerrit?

If We Using GitLab

There is a GitLab enterprise edition to support rebase and merge --no-ff, but we choose use community edition.

Is that possible to add the functionality (atomic rebase and merge --no-ff) to GitLab on our own? Any open-source GitLab plugin for this feature?

Upvotes: 1

Views: 654

Answers (1)

No, there isn't a way to force atomically rebase+submit (in whatever submit method). What about to use the "Rebase If Necessary" method? You'll get a very "clean" history without unnecessary merges, like this:

O --- O --- O --- O --- O --- O  <= master branch
       \               /
        O ---- O ---- O          <= task branch

Upvotes: 0

Related Questions