mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-22 14:08:01 +02:00
Add a simple way to rename branch like gh (#15870)
- Update default branch if needed - Update protected branch if needed - Update all not merged pull request base branch name - Rename git branch - Record this rename work and auto redirect for old branch on ui Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
@ -164,3 +164,9 @@ func (repo *Repository) RemoveRemote(name string) error {
|
||||
func (branch *Branch) GetCommit() (*Commit, error) {
|
||||
return branch.gitRepo.GetBranchCommit(branch.Name)
|
||||
}
|
||||
|
||||
// RenameBranch rename a branch
|
||||
func (repo *Repository) RenameBranch(from, to string) error {
|
||||
_, err := NewCommand("branch", "-m", from, to).RunInDir(repo.Path)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user