Wireshark-dev: Re: [Wireshark-dev] Struggling to rebase
From: Paul Offord <paul.offord58@xxxxxxxxx>
Date: Fri, 5 Mar 2021 18:19:51 +0000
Thank very much Jano.  I'll give that a try.

On Fri, Mar 5, 2021 at 11:52 AM Jano Svitok <jan.svitok@xxxxxxxxx> wrote:
I've a deeper look at your repo.
I suppose upstream remote is main wireshark repo, downstream is your own fork.

1. your downstream master is no aligned with upstream. if it is not intentional, you may start with fixing that.
   if it is indeed intentional, you may consider keeping your changes in a different-named branch and continue with the recipe :)

1.1 add remote to your local git repo (on your harddisk):
   git remote add upstream https://gitlab.com/wireshark/wireshark.git

1.2 get sources from upstream:
   git fetch --all

1.3 align local master with downstream master:
  git pull --rebase downstream master     if you have master checked out
  or
  git fetch downstream master:master    if you have another branch checked out

1.4 now align upstream and downstream
1.4.1 if you have checked out master
1.4.1.1 and master is clean:
   git pull --rebase upstream master
   git push downstream master

1.4.1.2 in your case, the first step fails, because your downstream master has some differences to upstream and they cause conflicts.
1.4.1.2.1 you can either forget them, and set your downstream master to upstream:
  git reset --hard upstream/master
  git push downstream --force
1.4.1.2.2 or store the differences somewhere
1.4.1.2.3 or use another branch to track upstream/master

1.4.2 if you have checked out another branch (e.g. issuexxxx):
1.4.2.1 if downstream/master is clean:
    git fetch upstream master:master
    git push downstream master
1.4.2.1 if downstream/master has additional stuff (will be lost):
    git fetch upstream master:master --force
    git push downstream master --force

2. now do rebase on your local master:
I see there some merge commits, it would be good if they somehow get lost along the way :)

git checkout issue17235
git rebase master
git push downstream --force-with-lease

Jano

On Fri, Mar 5, 2021 at 11:44 AM Jano Svitok <jan.svitok@xxxxxxxxx> wrote:
if you want to push your rebased changes, do "git push downstream --force-with-lease"

Jano

On Fri, Mar 5, 2021 at 11:22 AM Paul Offord <paul.offord58@xxxxxxxxx> wrote:
Hi,

I'm working on updates to sharkd.  I have pushed the changes to my downstream repo on gitlab.  The tests run fine but the Merge request shows:

Fast-forward merge is not possible. To merge this request, first rebase locally.

I made sure my local master was up to date with a git pull.  I then did:

git rebase master issue17235

issue17235 being my feature branch.  This gave me merge conflicts.  All of those conflicts related to changes to earlier versions of the same branch that I had pushed to downstream.

I'm now stuck in a bit of a loop:
  • I resolve the merge conflicts
  • I get a clean commit
  • I do:  git push downstream HEAD
  • That fails with:
    • To gitlab.com:credible58/wireshark.git
    •  ! [rejected]              HEAD -> issue17235 (non-fast-forward)
    • error: failed to push some refs to 'gitlab.com:credible58/wireshark.git'
    • hint: Updates were rejected because the tip of your current branch is behind
    • hint: its remote counterpart. Integrate the remote changes (e.g.
    • hint: 'git pull ...') before pushing again.
    • hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • I do the git pull as suggested
  • I have the same merge conflicts as I started with
I'm thinking of deleting my branch, abandoning the Merge Request and starting over.

Is that a bad idea?
Is there a simpler solution?

Thanks and regards...Paul

--

Paul Offord

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe


--

Paul Offord