#1113784 Add option to create orphaned branches with `git import-dsc`

#1113784#5
Date:
2025-09-02 15:32:10 UTC
From:
To:
Hi,

in the LTS team we regularly create new git repos conforming to DEP-14 and
import source packages into it.

For example:
gbp import-dsc --create-missing-branches --debian-branch=debian/bookworm --upstream-branch=upstream/bookworm ../git_2.39.5-0+deb12u2.dsc

This however has the problem that gbp will use the *current* branch as point to
create the new branch debian/bookworm, which will in then carry the history of
an unrelated release with it.

A workaround exists:
You can create the branches e.g. debian/bookworm and upstream/bookworm, and add
empty commits there. Then the command above will correctly create a detached
history.

So my request is adding e.g. --create-orphaned-branches will will in this case
use `git checkout --orphan upstream/bookworm` before importing the ustream
source onto it.

Thanks for maintaining gbp!

Greetings,
Lee

#1113784#10
Date:
2025-09-02 15:56:11 UTC
From:
To:
Hi,

I don't understand what you're describing here. There are no "current
branches" in a newly create repo.

If I understand your problem correctly then just don't create the repo beforehand:

```
gbp import-dsc --debian-branch=debian/bookworm --upstream-branch=upstream/bookworm apt:git/sid
```

I get exactly two branches;

```
$ git branch
* debian/bookworm
upstream/bookworm
```

Which is what I'd expect in these situations so I'd say we don't need to
do anything here.

Cheers,
 -- Guido