Wireshark-dev: Re: [Wireshark-dev] Quick start instructions for Gerrit

From: Roland Knall <rknall@xxxxxxxxx>
Date: Fri, 31 Jan 2014 09:17:53 +0100
Hi

There are a couple of reasons why you should not work on master, and
they nearly all come back to the argument: "rebase is nearly allways
preferable over merge"

1. You are doing local reviews of patches. Those can be done in
separate sub-branches and reside there, no matter if you pull up
master or not, the sub-branch will stay correctly on the revision you
had it, when the review started

2. You may work on various parts of the source at the same time, e.g.
changing an interface for the UI and therefore adding changes to gtk,
qt and tshark at the same time. For this you add a branch for the
underlying change, and each individual change is handled in different
branches. If you need to change the underlying interface, you switch
back to the if branch and so on

3. Merge-branches show up in the main repo, if you have push privileges

4. You can allways start with a clean slate, and don't have to
roll-back and forth.

Those are a couple of reasons why,

You can also take a look at
http://stackoverflow.com/questions/457927/git-workflow-and-rebase-vs-merge-questions
or http://git-scm.com/book/ch3-6.html for other reasons.

Btw, in you scenario you allways rebase from the remote repo. Now, I
work sometimes during train rides or from my home office. In both
cases I do not have access to our company gerrit repo. But in both
cases I might revert my work or change stuff which would break other
stuff. By having a clean master I will allways have a clean point to
fall back on.

Of course, those are just my own reasons derived from my own working
experience ;-) Everything depends on each individuals own perspective.
If you found a way that works for you, stick to it.

kind regards,
Roland

On Fri, Jan 31, 2014 at 8:27 AM, Michal Labedzki
<michal.labedzki@xxxxxxxxx> wrote:
> On 30 January 2014 21:08, Guy Harris <guy@xxxxxxxxxxxx> wrote:
>>
>> On Sep 18, 2013, at 5:52 PM, Marc Petit-Huguenin <marc@xxxxxxxxxxxxxxxxxx> wrote:
>>
>>> One of the essential rule is that you *never*, *ever* work in the master branch.
>>
>> Why not?
>
> I agree with this question. "master" is local branch and
> "origin/master" is all time accessible (it is remote "master"). So I
> assume we can work on any local branch. Also "origin/master" is truly
> read-only.
>
> My "instruction":
> $ git fetch gerrit # sync to remote git ("origin")
> From https://code.wireshark.org/review/wireshark
>    458b835..5c7d57a  master     -> gerrit/master
>    d3bd396..0b6bb29  master-1.10 -> gerrit/master-1.10
>
>
> $ git diff --stat 458b835..5c7d57a # quick looking for interesting changes
>  .gitignore                   |  6 ++++--
>  epan/dissectors/packet-tcp.c |  1 +
>  epan/packet.c                | 15 +++++++++++++++
>  epan/packet.h                |  2 ++
>
>
> $ git log  -p 458b835..5c7d57a .gitignore   # see who and what
>
> ...
>
> $ git push gerrit HEAD:refs/drafs/master # if need show draft, work
> progress, RFC, etc.
>
> ...
>
> $ git fetch gerrit
> $ git checkout -b gerrit_push gerrit/master
> $ git cherrypick master~4
> $ git cherrypick master~5
> $ git push gerrit HEAD:refs/publish/master # send to gerrit
> $ git checkout master
>
>
> ...
> # when need update to latest git
>
> # $ git checkout master
> $ git fetch gerrit
> $ git rebase gerrit/master
>
> ...
> # useful commands
>
>
> # $ git checkout master
> git add -p # sometimes is useful
> git add -u
> git status
> git diff
> git diff --stat
> git commit --amend
> git rebase -i gerrit/master # do fixups, change commit order
> git log --decorate=full --stat --pretty=fuller
>
>
> --
>
> Pozdrawiam / Best regards
> -------------------------------------------------------------------------------------------------------------
> Michał Łabędzki, Software Engineer
> Tieto Corporation
>
> Product Development Services
>
> http://www.tieto.com / http://www.tieto.pl
> ---
> ASCII: Michal Labedzki
> location: Swobodna 1 Street, 50-088 Wrocław, Poland
> room: 5.01 (desk next to 5.08)
> ---
> Please note: The information contained in this message may be legally
> privileged and confidential and protected from disclosure. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any unauthorised use, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by replying to
> the message and deleting it from your computer. Thank You.
> ---
> Please consider the environment before printing this e-mail.
> ---
> Tieto Poland spółka z ograniczoną odpowiedzialnością z siedzibą w
> Szczecinie, ul. Malczewskiego 26. Zarejestrowana w Sądzie Rejonowym
> Szczecin-Centrum w Szczecinie, XIII Wydział Gospodarczy Krajowego
> Rejestru Sądowego pod numerem 0000124858. NIP: 8542085557. REGON:
> 812023656. Kapitał zakładowy: 4 271500 PLN
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe