Wireshark-dev: Re: [Wireshark-dev] Struggling to rebase

From: chuck c <bubbasnmp@xxxxxxxxx>
Date: Fri, 5 Mar 2021 16:25:35 -0600

"Run git push downstream +HEAD.
The "+" is shorthand for force-pushing and will be needed if you amended your commit.
Multiple commits are also allowed."

I try to follow the steps on the Wiki page but tend to overlook the "+HEAD" when updating a commit.:

admin1@MSEDGEWIN10:/mnt/c/Development/wireshark$ git push downstream HEAD
Enter passphrase for key '/c/Users/IEUser/.ssh/id_ed25519':
To gitlab.com:chuckcraft/wireshark.git
 ! [rejected]              HEAD -> issue/17270 (non-fast-forward)
error: failed to push some refs to 'gitlab.com:chuckcraft/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.

admin1@MSEDGEWIN10:/mnt/c/Development/wireshark$ git push downstream +HEAD
Enter passphrase for key '/c/Users/IEUser/.ssh/id_ed25519':
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 504 bytes | 50.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for issue/17270, visit:
remote:   https://gitlab.com/chuckcraft/wireshark/-/merge_requests/new?merge_request%5Bsource_branch%5D=issue%2F17270
remote:
To gitlab.com:chuckcraft/wireshark.git
 + f768d5869e...5ce7e63e74 HEAD -> issue/17270 (forced update)

admin1@MSEDGEWIN10:/mnt/c/Development/wireshark$

But sometimes I'm this guy:


On Fri, Mar 5, 2021 at 3:19 PM Paul Offord <paul.offord58@xxxxxxxxx> wrote:
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

___________________________________________________________________________
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