git / gerrit best work flow ?

Eike Rathke erack at redhat.com
Mon Nov 9 10:42:06 PST 2015


Hi jan,

On Monday, 2015-11-09 10:00:01 -0700, jan iversen wrote:

> Sometimes I have to correct an older patch set, I do the following in core:
> 
> git pull
> <cherry pick gerrit patch set>
> make changes
> ./logerrit ...
> 
> Then in order to cleanup I do
> git reset head~
> git checkout files from changeset
> 
> This does not seem optimal, any suggestion on how to effectively work with
> different changesets fast ?

Use git-review ;-)
https://wiki.documentfoundation.org/Development/GitReview
(that page btw seems a bit outdated regarding installation, git-review
should be available now with all(?) distros, and the page should not
focus on git-review development but usage in our gerrit process instead)

Instead of git-review you can also use ./logerrit to create a branch and
cherry-pick the gerrit change and submit an amended commit for that
change and clean the temporary branch, but git-review does all that for
you. Plus, which I regard as a big bonus, it warns about multiple
commits that are about to be pushed to gerrit, whereas ./logerrit
silently pushes them all.

So, basically

# download changenumber and apply on a temporary branch named after
# submitter and changenumber (changenumber is the currently 5 digits
# gerrit change, not the Change-Id):
git review <changenumber>
# do your changes
git commit --amend ...
git review -R -f
# -R skips rebasing change (may be desired when amending a change, see
# git review --help), then pushes to gerrit, and -f finishes the
# temporary branch, switching back to your branch and removing the
# temporary branch

You can also use  git review -x <changenumber>   to just cherry-pick
onto your current branch without creating a named branch, e.g. if your
master isn't ahead of origin/master and a  git review   would not result
in multiple changes to be pushed, and after submitting to gerrit do
git reset --hard HEAD^
Otherwise a separate branch is of advantage.

Btw,  git reset HEAD^   (without --hard) probably is not what you want
(actually it is the same as  git reset --mixed HEAD^ ), it just undoes
the commit and preserves the modified files, so you could git add and
include them in your next commit..

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20151109/a49c830b/attachment.sig>


More information about the LibreOffice mailing list