[git-buildpackage] Is there a way to manually reconstruct the upstream branch if it diverged?

Markus Blatt markus at dr-blatt.de
Sat Oct 25 17:33:07 CEST 2025


Hi,

Am Fri, Oct 24, 2025 at 10:39:03PM +0200 schrieb Guido Günther:
>
>On Fri, Oct 24, 2025 at 09:13:57PM +0200, Markus Blatt wrote:
>> Hi,
>>
>> I must have somehow messed up my local upstream branch before running "gbp import --uscan".
>> I think I did a "git reset --hard" with a wrong earlier commit and lost at least one tag on the upstream
>> branch
>
>"git reflog"

Thanks, I will also look into that.

>
>apart from that if you have the "lost" commits on the remote you can
>just fetch that and rebase (after all it's a git branch like any other)
>

my problem with that is that tags won't match and I get a lot of ugly merge conficts, that I have to resolve.

What I did now was just to merge in the the tag used for a Debian release. Now I have a merge conflict and gbp
push complains that

gbp:info: Pushing 17b5bd5a99388d23b9085c58f30f8b572326306e to origin:refs/heads/upstream
gbp:error: Error running git push: X11 forwarding request failed on channel 0
To salsa.debian.org:science-team/opm-common.git
  ! [rejected]            17b5bd5a99388d23b9085c58f30f8b572326306e -> upstream (non-fast-forward)
Fehler: Fehler beim Versenden einiger Referenzen nach 'salsa.debian.org:science-team/opm-common.git'
Hinweis: Aktualisierungen wurden zurückgewiesen, weil die Spitze eines versendeten
Hinweis: Branches hinter seinem externen Gegenstück zurückgefallen ist. Checken Sie
Hinweis: diesen Branch aus und führen Sie die externen Änderungen zusammen
Hinweis: (z. B. 'git pull ...') bevor Sie erneut "push" ausführen.
Hinweis: Siehe auch die Sektion 'Note about fast-forwards' in 'git push --help'
Hinweis: für weitere Details.
gbp:error: Failed to push some refs.

It is not pushing HEAD but the commit the  release is based on. That can't work.

$ git log -2 --oneline upstream
5a5db414c (HEAD -> upstream) Merge branch 'upstream-backup' into upstream
17b5bd5a9 (tag: upstream/2025.10+ds, upstream-backup) New upstream version 2025.10+ds

But pushing HEAD manually might/should work. Hence my question is:

If I push the HEAD, will that cretae problems for the next gbp import --uscan command?

Cheers,

Markus

>
>>
>> Unfortunately, I only noticed this after uploading the new version to unstable when I ran gbp push.
>> It failed because the remote and local upstream branches aree diverged.
>>
>> The current status is
>> - pristine-tar branch has the last tarball and is pushed
>> - master branch (which holds the status for Debian unstable), has the tag for the last uploaded Debian release.
>> - local upstream branch has diverged from origin/upstream.
>>
>> Is there a good way to manually fix my local upstream branch and push?
>>
>> Thanks a lot for your help.
>>
>> Best,
>>
>> Markus
>>
>>
>>
>> _______________________________________________
>> git-buildpackage mailing list
>> git-buildpackage at lists.sigxcpu.org
>> http://lists.sigxcpu.org/mailman/listinfo/git-buildpackage
>>
>_______________________________________________
>git-buildpackage mailing list
>git-buildpackage at lists.sigxcpu.org
>http://lists.sigxcpu.org/mailman/listinfo/git-buildpackage
>

-- 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Pedettistr. 38, 85072 Eichstätt, Germany,  USt-Id: DE279960836
Tel.: +49 (0) 160 97590858


More information about the git-buildpackage mailing list