Multi-branch templates #6584

Open
opened 2025-11-02 07:00:15 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @clarfonthey on GitHub (Dec 25, 2020).

Description

Right now, when creating a repository from a template, you can only copy over the default branch. It would be nice to be able to initialise a repository with multiple branches using templates.

There are a few different approaches to this that could be taken:

  1. Allowing branches from templates to be copied to repositories at any time, with any name on the target. The multiple branches would be stored as separate template repos.
  2. Allow copying multiple branches from a single template repository when creating a repository from a template.
  3. Allow specifying additional branches to be copied over in .gitea/template.

A few use cases:

  1. Repositories might by default have separate dev and prod branches with different details in them to specify different deployment targets, and a template would want to encode this
  2. Repositories might separate out branches for documentation or software packaging from the base project, while still keeping them in the same repo
  3. If adding templates as branches after repos are created is allowed, then when there is an update to a template it could be added as an extra branch so that a user could try and merge the changes together using git's built-in features.

Screenshots

Screenshot from 2020-12-24 22-33-42

Current view when choosing a template for a new repository.

Right now, the list of checkboxes seems a bit unsustainable if multiple options are to be presented. For one, with this current layout, it seems that the only feasible option would be to add another checkbox for "copy other branches," without anything else. Perhaps this layout should be updated as well.

Originally created by @clarfonthey on GitHub (Dec 25, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> ## Description Right now, when creating a repository from a template, you can only copy over the default branch. It would be nice to be able to initialise a repository with multiple branches using templates. There are a few different approaches to this that could be taken: 1. Allowing branches from templates to be copied to repositories at any time, with any name on the target. The multiple branches would be stored as separate template repos. 2. Allow copying multiple branches from a single template repository when creating a repository from a template. 3. Allow specifying additional branches to be copied over in `.gitea/template`. A few use cases: 1. Repositories might by default have separate `dev` and `prod` branches with different details in them to specify different deployment targets, and a template would want to encode this 2. Repositories might separate out branches for documentation or software packaging from the base project, while still keeping them in the same repo 3. If adding templates as branches after repos are created is allowed, then when there is an update to a template it could be added as an extra branch so that a user could try and merge the changes together using git's built-in features. ## Screenshots ![Screenshot from 2020-12-24 22-33-42](https://user-images.githubusercontent.com/15850505/103117417-4b472a00-4638-11eb-9d98-7be0aa2e1515.png) Current view when choosing a template for a new repository. Right now, the list of checkboxes seems a bit unsustainable if multiple options are to be presented. For one, with this current layout, it seems that the only feasible option would be to add another checkbox for "copy other branches," without anything else. Perhaps this layout should be updated as well.
GiteaMirror added the type/proposal label 2025-11-02 07:00:15 -06:00
Author
Owner

@uarmes commented on GitHub (Jul 24, 2024):

Lack of this feature leads to tedious clicking every time a new repo is being created. Obviously it can be automated, but marking one checkbox would be easier.

@uarmes commented on GitHub (Jul 24, 2024): Lack of this feature leads to tedious clicking every time a new repo is being created. Obviously it can be automated, but marking one checkbox would be easier.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6584