gitflow and Gerrit

1,454 views
Skip to first unread message

aoeui

unread,
Feb 19, 2016, 8:21:45 AM2/19/16
to Repo and Gerrit Discussion
Does anybody use Gerrit as a review tool in conjunction with gitflow
branching model? In many places I read that it's a bad idea and that
Gerrit is not suitable for this. However, I can't see any
disadvantages. If gitflow was deployed only commits that need review
(feature/hotfix etc.) will go through Gerrit, everything else will be
done separately (for example non fast-forward merge of feature branch
into devel branch). So is there really anything bad in using gitflow
and Gerrit?

Alex Blewitt

unread,
Feb 19, 2016, 8:52:38 AM2/19/16
to aoeui, Repo and Gerrit Discussion
Gerrit reviews changes on a commit by commit basis, whereas git flow is develop-on-a-branch and then review the result. So Gerrit and git flow wouldn't really make sense. In addition it's almost pointless because all git flow does is encourage people to do development off the master branch, which is essentially what a review tool like Gerrit is for. 

Think about it as Gerrit managing all of your branching needs automatically and the merge to master is the same as submitting the set of changes, and you won't be fighting the model. Anything else - well, it won't end happily for you and you'll go away upset that it works in a different way to the way you want to work.

Git flow is a crutch to support inferior review systems like pull requests.  

Alex

Sent from my iPhat 6
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aoeui

unread,
Feb 19, 2016, 9:06:59 AM2/19/16
to Repo and Gerrit Discussion, wem...@gmail.com
On Friday, February 19, 2016 at 2:52:38 PM UTC+1, AlBlue wrote:
Gerrit reviews changes on a commit by commit basis, whereas git flow is develop-on-a-branch and then review the result. So Gerrit and git flow wouldn't really make sense. In addition it's almost pointless because all git flow does is encourage people to do development off the master branch, which is essentially what a review tool like Gerrit is for. 

Think about it as Gerrit managing all of your branching needs automatically and the merge to master is the same as submitting the set of changes, and you won't be fighting the model. Anything else - well, it won't end happily for you and you'll go away upset that it works in a different way to the way you want to work.

Git flow is a crutch to support inferior review systems like pull requests.  


But how about when you develop a new feature and you want to split it
into multiple commits and not show unfinished work by pushing commits
and review them directly on devel/master? In such case it would be
nice to create a separate feature branch, make review of each commit
on this branch and then merge back into devel/master?

BTW, of course I don't ask `git flow' specifically here but about a
branching model commonly known as git-flow.

Luca Milanesio

unread,
Feb 19, 2016, 9:17:56 AM2/19/16
to aoeui, Repo and Gerrit Discussion
Hi,
have you tried git-review? see [1]

Allows you to use feature branches locally and push them as reviews to Gerrit under the same topic.

Luca.


aoeui

unread,
Feb 19, 2016, 9:30:51 AM2/19/16
to Repo and Gerrit Discussion, wem...@gmail.com
On Friday, February 19, 2016 at 3:17:56 PM UTC+1, lucamilanesio wrote:
Hi,
have you tried git-review? see [1]

Allows you to use feature branches locally and push them as reviews to Gerrit under the same topic.

I tried it and considered useless but I didn't see try anything
related to pushing multiple changes under the same topic. If anything,
I would like to minimize usage of number of tools are wrappers over
wrappers.

Luca Milanesio

unread,
Feb 19, 2016, 9:33:49 AM2/19/16
to aoeui, Repo and Gerrit Discussion
On 19 Feb 2016, at 14:30, aoeui <wem...@gmail.com> wrote:

On Friday, February 19, 2016 at 3:17:56 PM UTC+1, lucamilanesio wrote:
Hi,
have you tried git-review? see [1]

Allows you to use feature branches locally and push them as reviews to Gerrit under the same topic.

I tried it and considered useless but I didn't see try anything
related to pushing multiple changes under the same topic.
 
It actually does it for you: all the commits on the local feature branch are pushed as changes on the same topic.
Is not this what you need?

Can you express your requirements?

If anything,
I would like to minimize usage of number of tools are wrappers over
wrappers.

git-review is only a help for you to type less complex git commands: if you can still achieve the same results using Git alone.

Luca.

Luca Milanesio

unread,
Feb 19, 2016, 9:41:49 AM2/19/16
to aoeui, Repo and Gerrit Discussion
Let me go back to your original question: "does it make sense to use Gitflow *and* Gerrit" ?

Generally speaking, NO. Having said that, if you really like Gitflow and you want to adopt in your project only as branching model, there isn't any problem with that from a technical perspective.
Just bear in mind that you do not need it with Gerrit, but if you like it and you are willing to manually managing it, it is up to you :-)

There was a discussion as well about Gitflow vs. Gerrit (or similar) review systems:

Happy reading :-)

Luca.

aoeui

unread,
Feb 19, 2016, 9:48:00 AM2/19/16
to Repo and Gerrit Discussion, wem...@gmail.com
On Friday, February 19, 2016 at 3:33:49 PM UTC+1, lucamilanesio wrote:

On 19 Feb 2016, at 14:30, aoeui <wem...@gmail.com> wrote:

On Friday, February 19, 2016 at 3:17:56 PM UTC+1, lucamilanesio wrote:
Hi,
have you tried git-review? see [1]

Allows you to use feature branches locally and push them as reviews to Gerrit under the same topic.

I tried it and considered useless but I didn't see try anything
related to pushing multiple changes under the same topic.
 
It actually does it for you: all the commits on the local feature branch are pushed as changes on the same topic.
Is not this what you need?
Can you express your requirements?

 So far I just created a new remote like this:

[remote "review"]
         url = ssh://<SERVER>/<PROJECT>
         push = HEAD:refs/for/<BRANCH>%r=<REVIEWERS...>

and pushed code for review like this:

$ git push review

The reason why I am asking this question in the first place is that we
want employ git flow in our project what means we want to have a
separate devel, master, feature, release and hotfix branches but we
want to continue using Gerrit as a review tool. So far we only had a
single branch and when multiple commits related to a single feature
were pushed all at once there were numbered like "1/3", "2/3" and
"3/3".

Luca Milanesio

unread,
Feb 19, 2016, 9:54:22 AM2/19/16
to aoeui, Repo and Gerrit Discussion
You can do whatever you want if that makes sense to you and your team :-)
If it works for you and makes your life easier, why not?

Luca.

Welch, Ronald P (US)

unread,
Feb 19, 2016, 10:13:28 AM2/19/16
to Luca Milanesio, aoeui, Repo and Gerrit Discussion
IMHO, the fact that git-flow is so well documented, with illustrative diagrams, is part of why has become so widespread. It would be nice to see best practices for collaborating on software releases with Gerrit, especially with regard to topics, illustrated and explained in a similar way. Just by two cents.

Also, we use a modified version of git-flow with Gerrit. Some of the modifications we have made are that we maintain a linear history by not using merge commits, and we also base features off a release candidate branch rather than a shared development branch.

Ron
----------=-=-=-=-=-=-=-=-========oOo========-=-=-=-=-=-=-=-=----------
mailto:Ronald....@baesystems.com                Phone:(607)206-8718
BAE SYSTEMS                       1701 North Street, Endicott, NY 13760
----------=-=-=-=-=-=-=-=-===================-=-=-=-=-=-=-=-=----------

On Feb 19, 2016, at 9:54 AM, Luca Milanesio wrote:

*** WARNING ***
EXTERNAL EMAIL -- This message originates from outside our organization.


Kenny Ho

unread,
Feb 19, 2016, 3:24:17 PM2/19/16
to Repo and Gerrit Discussion, wem...@gmail.com
I didn't see this get mentioned in the thread, but have you try using Gerrit's topic branch concept as an analog to the git flow feature branch?  (i.e. pushing to refs/for/<branch>/<topic>)?

Luca Milanesio

unread,
Feb 19, 2016, 4:14:07 PM2/19/16
to Kenny Ho, Repo and Gerrit Discussion, wem...@gmail.com
I mentioned that :-) + using git-review that associate a local feature branch with a remote Gerrit topic.

Luca.

Mark Derricutt

unread,
Feb 21, 2016, 8:24:36 PM2/21/16
to aoeui, Repo and Gerrit Discussion

On 20 Feb 2016, at 2:21, aoeui wrote:

Does anybody use Gerrit as a review tool in conjunction with gitflow
branching model? In many places I read that it's a bad idea and that
Gerrit is not suitable for this. However, I can't see any
disadvantages. If gitflow was deployed only commits that need review

We're using Gitflow and Gerrit together and it works fine ( for us ).

Basically, we only really track the develop branch in Gerrit, and the occasional support/XXX branch for modules, the master branch is actually tracked on an upstream repo server and not currently pushed to gerrit.

Everything else git-flowish is just local to the developers machine - feature branches are local and server to isolate concurrent work by a developer, since they ultimately get merged into develop from gitflow, we push these are reviews for/develop in Gerrit. If we're working on a support branch, then changes destined for that are pushed for/support/NNN.

--
Mark Derricutt
http://www.theoryinpractice.net
http://www.chaliceofblood.net
http://plus.google.com/+MarkDerricutt
http://twitter.com/talios
http://facebook.com/mderricutt

signature.asc
Reply all
Reply to author
Forward
0 new messages