Wireshark-dev: Re: [Wireshark-dev] Migrate to GitLab?

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 8 Oct 2019 01:46:18 -0700
On Oct 8, 2019, at 1:34 AM, Dario Lombardo <lomato@xxxxxxxxx> wrote:

> On Tue, Oct 8, 2019, 00:34 Guy Harris <guy@xxxxxxxxxxxx> wrote:
> 1) Can you push (or whatever) a proposed commit to GitLab and then do a git commit --amend, changing either code or commit message, and then push and have that amend the commit-on-GitLab, without polluting the history?
> 
> Yes. Provided you're working on a branch. As in github, the master branch is protected. You can't amend a commit and then push it to master. This would require a force push, that is not allowed on master branch, but it's allowed on other branches. A good practice is to push always to a branch, create a MR, let the CI run and mark the MR to be merged as soon as the CI passes. However for higher users, direct commit/push is allowed (for instance for trivial patches as typos this is the preferred way, to avoid using resources for useless CI runs).

As long as I can work, in my own repository, on the master branch for as long as possible (so that I'm forced to keep my changes in sync with what happens on the master branch - *being forced to do so isn't a bug, it's a feature!*) and do all the branch gunk at the very last minute, that might work.

> 3) Will I be forced to use branches in my local repository or can I do all my work in the default branch?
> 
> This is git stuff. On master branch you can do whatever work you want. Instead of pushing on master, you can push on another branch:
> 
> git push origin HEAD:feature-number-1

And can I then do a "git commit --amend" and another "git push origin HEAD:feature-number-1" to fix issues found in the review/Petri dish/going back and looking at what I did process?

And I'm still on the master branch there, so a "git pull" will pick up changes from the master branch (and then I do enough rebases to preserve the "the master or wireshark-x.y.z branch is The Official Source, everything else in the universe, including my repositories, is secondary" model I use)?

> If you have 3 new commits in your master branch, 
> 
> HEAD^^ ==> ready to roll
> HEAD^ ==> not ready
> HEAD ==> not ready
> 
> you can still push your partial work
> 
> git push origin HEAD^^:ready-to-roll

OK, although I don't work that way.  (I have separate *checked-out repositories* for each project I work on.  Yes, I have a *lot* of repositories on my machine.)