Feature request - changing default branch name #4566

Closed
opened 2025-11-02 05:54:49 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @clarfonthey on GitHub (Dec 30, 2019).

Right now, gitea always defaults to creating a master branch as the default, and the default can be changed per repo with a setting. It would be nice if we could change the default branch name so that new repos would be created with the given name, e.g. if you wanted to use prod instead of master.

Originally created by @clarfonthey on GitHub (Dec 30, 2019). Right now, gitea always defaults to creating a `master` branch as the default, and the default can be changed per repo with a setting. It would be nice if we could change the default branch name so that new repos would be created with the given name, e.g. if you wanted to use `prod` instead of `master`.
GiteaMirror added the type/featureissue/confirmed labels 2025-11-02 05:54:49 -06:00
Author
Owner

@zeripath commented on GitHub (Dec 30, 2019):

The first branch you push to an empty repository will become the default.

@zeripath commented on GitHub (Dec 30, 2019): The first branch you push to an empty repository will become the default.
Author
Owner

@clarfonthey commented on GitHub (Dec 30, 2019):

You're given the option to initialise the repo with a readme and license, which always chooses master.

@clarfonthey commented on GitHub (Dec 30, 2019): You're given the option to initialise the repo with a readme and license, which always chooses master.
Author
Owner

@zeripath commented on GitHub (Dec 30, 2019):

Ok.

Fairly simple thing to do - good first pr.

If you want it quickly stick a bounty on bounty source.

@zeripath commented on GitHub (Dec 30, 2019): Ok. Fairly simple thing to do - good first pr. If you want it quickly stick a bounty on bounty source.
Author
Owner

@stale[bot] commented on GitHub (Feb 28, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 28, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@clarfonthey commented on GitHub (Feb 28, 2020):

Still would like this.

@clarfonthey commented on GitHub (Feb 28, 2020): Still would like this.
Author
Owner
@TimerWolf commented on GitHub (Mar 26, 2020): Is this a typo? https://github.com/go-gitea/gitea/blob/bbd910ed1b4f52ee66a5cdd8d11f856598161bef/modules/repository/generate.go#L116
Author
Owner

@zeripath commented on GitHub (Mar 26, 2020):

No it's a go fmt related change. (The Depth: 1 option is used when generating from template repos.)

@zeripath commented on GitHub (Mar 26, 2020): No it's a `go fmt` related change. (The `Depth: 1` option is used when generating from template repos.)
Author
Owner

@TimerWolf commented on GitHub (Mar 26, 2020):

@zeripath: fun that you did not notice it, i could be wrong. But before the commit it's only use one white-space with the commit two white-spaces are used.

And you say that it is "Depth: 1" and not "Depth:  1" as the code says, that's why i asked if it was a typo or not, but even if the code works it could be a typo i think depending on how you see on it :)

@TimerWolf commented on GitHub (Mar 26, 2020): @zeripath: fun that you did not notice it, i could be wrong. But before the commit it's only use one white-space with the commit two white-spaces are used. And you say that it is "Depth: 1" and not "Depth:  1" as the code says, that's why i asked if it was a typo or not, but even if the code works it could be a typo i think depending on how you see on it :)
Author
Owner

@zeripath commented on GitHub (Mar 26, 2020):

It's a go fmt change.

@zeripath commented on GitHub (Mar 26, 2020): It's a go fmt change.
Author
Owner

@TimerWolf commented on GitHub (Mar 26, 2020):

I don't know what that means, i don't code in go language, i just think it was worth a notice :)

Sorry if bother you...

@TimerWolf commented on GitHub (Mar 26, 2020): I don't know what that means, i don't code in go language, i just think it was worth a notice :) Sorry if bother you...
Author
Owner

@zeripath commented on GitHub (Mar 27, 2020):

Instead of looking at the diff take a look at the file:

https://github.com/go-gitea/gitea/blob/cf4f2cfa3ee0e71632df971e154c7b926c39ba80/modules/repository/generate.go#L115-L118

See how the values now align vertically. Look elsewhere in that file and you'll see various other places where there is vertical aligning.

If you add an attribute to a struct initialiser or definition go fmt will align them.

Go is quite opinionated on its formatting - code should and often must be formatted with gofmt.

@zeripath commented on GitHub (Mar 27, 2020): Instead of looking at the diff take a look at the file: https://github.com/go-gitea/gitea/blob/cf4f2cfa3ee0e71632df971e154c7b926c39ba80/modules/repository/generate.go#L115-L118 See how the values now align vertically. Look elsewhere in that file and you'll see various other places where there is vertical aligning. If you add an attribute to a struct initialiser or definition `go fmt` will align them. Go is quite opinionated on its formatting - code should and often must be formatted with gofmt.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4566