[git-buildpackage] DEP-14 conversion: what happens if remote renamed branch upstream -> upstream/latest

Otto Kekäläinen otto at debian.org
Mon Aug 11 22:46:16 CEST 2025


Hi,

This came up a couple of times in DebConf and nobody has the exact
answer on their mind, so documenting it here now:

What happens if I have a git clone of a repository and the maintainer
renames upstream -> upstream/latest?

There is a conflict in reference paths and I will get this:

± gbp pull --track-missing xxx
gbp:info: Fetching from 'xxx'
gbp:error: Error running git branch: fatal: cannot lock ref
'refs/heads/upstream/latest': 'refs/heads/upstream' exists; cannot
create 'refs/heads/upstream/latest'

This is however very easy to fix, I just run:
± git branch -m upstream upstream/latest

And then the pull works just fine:
± gbp pull --track-missing xxx
gbp:info: Fetching from 'xxx'
gbp:info: Branch 'debian/latest' is already up to date.
gbp:info: Branch 'pristine-tar' is already up to date.
gbp:info: Updating 'upstream/latest': 659ac917b0c2..fc794704e2cd

As this is a common scenario, maybe git-buildpackage could try to
handle it automatically?

- Otto


More information about the git-buildpackage mailing list