go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.01k stars 5.49k forks source link

Multi-branch templates #14145

Open clarfonthey opened 3 years ago

clarfonthey commented 3 years ago

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.

uarmes commented 3 months ago

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.