[openstack-dev] [git-review] Supporting development in local branches

Sylvain Bauza sbauza at redhat.com
Tue Aug 5 13:27:06 UTC 2014


Le 05/08/2014 13:06, Ryan Brown a écrit :
>
> On 08/04/2014 07:18 PM, Yuriy Taraday wrote:
>> Hello, git-review users!
>>
>> <snip
>> 0. create new local branch;
>>
>> master: M--....
>>           \
>> feature:  *
>>
>> 1. start hacking, doing small local meaningful (to you) commits;
>>
>> master: M--....
>>           \
>> feature:  A-B-...-C
>>
>> 2. since hacking takes tremendous amount of time (you're doing a Cool
>> Feature (tm), nothing less) you need to update some code from master, so
>> you're just merging master in to your branch (i.e. using Git as you'd
>> use it normally);
>>
>> master: M--....-N-O-...
>>           \    \    \
>> feature:  A-B-...-C-D-...
>>
>> 3. and now you get the first version that deserves to be seen by
>> community, so you run 'git review', it asks you for desired commit
>> message, and <poof, magic-magic> all changes from your branch is
>> uploaded to Gerrit as _one_ change request;
>>
>> master: M--....-N-O-...
>>           \    \    \----E* <= uploaded
>> feature:  A-B-...-C-D-...-E
>>
>> <snip>
> +1, this is definitely a feature I'd want to see.
>
> Currently I run two branches "bug/LPBUG#-local" and "bug/LPBUG#" where
> the local is my full history of the change and the other branch is the
> squashed version I send out to Gerrit.

-1 to this as git-review default behaviour. Ideally, branches should be 
identical in between Gerrit and local Git.

I can understand some exceptions where developers want to work on 
intermediate commits and squash them before updating Gerrit, but in that 
case, I can't see why it needs to be kept locally. If a new patchset has 
to be done on patch A, then the local branch can be rebased 
interactively on last master, edit patch A by doing an intermediate 
patch, then squash the change, and pick the later patches (B to E)

That said, I can also understand that developers work their way, and so 
could dislike squashing commits, hence my proposal to have a --no-squash 
option when uploading, but use with caution (for a single branch, how 
many dependencies are outdated in Gerrit because developers work on 
separate branches for each single commit while they could work locally 
on a single branch ? I can't iimagine how often errors could happen if 
we don't force by default to squash commits before sending them to Gerrit)

-Sylvain

> Cheers,




More information about the OpenStack-dev mailing list