mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-21 21:48:00 +02:00
Option to set default branch at repository creation (#10803)
* Option to set default branch at repository creation * Handle template repos with non-default master branch * Add DefaultBranch handling on creation to API Fix #9542 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@ -162,6 +162,10 @@
|
||||
<label>{{.i18n.Tr "repo.auto_init"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label for="default_branch">{{.i18n.Tr "repo.default_branch"}}</label>
|
||||
<input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="master">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
@ -52,7 +52,7 @@ git init
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add origin <span class="clone-url">{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}</span>
|
||||
git push -u origin master</code></pre>
|
||||
git push -u origin {{if ne .Repository.DefaultBranch "master"}}master:{{.Repository.DefaultBranch}}{{else}}master{{end}}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
@ -61,7 +61,7 @@ git push -u origin master</code></pre>
|
||||
<h3>{{.i18n.Tr "repo.push_exist_repo"}}</h3>
|
||||
<div class="markdown">
|
||||
<pre><code>git remote add origin <span class="clone-url">{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}</span>
|
||||
git push -u origin master</code></pre>
|
||||
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
@ -10600,6 +10600,11 @@
|
||||
"type": "boolean",
|
||||
"x-go-name": "AutoInit"
|
||||
},
|
||||
"default_branch": {
|
||||
"description": "DefaultBranch of the repository (used when initializes and in template)",
|
||||
"type": "string",
|
||||
"x-go-name": "DefaultBranch"
|
||||
},
|
||||
"description": {
|
||||
"description": "Description of the repository to create",
|
||||
"type": "string",
|
||||
|
Reference in New Issue
Block a user