MCPcopy Index your code
hub / github.com/go-git/go-git / DeleteBranch

Method DeleteBranch

repository.go:723–735  ·  view source on GitHub ↗

DeleteBranch delete a Branch from the repository and delete the config

(name string)

Source from the content-addressed store, hash-verified

721
722// DeleteBranch delete a Branch from the repository and delete the config
723func (r *Repository) DeleteBranch(name string) error {
724 cfg, err := r.Config()
725 if err != nil {
726 return err
727 }
728
729 if _, ok := cfg.Branches[name]; !ok {
730 return ErrBranchNotFound
731 }
732
733 delete(cfg.Branches, name)
734 return r.Storer.SetConfig(cfg)
735}
736
737// CreateTag creates a tag. If opts is included, the tag is an annotated tag,
738// otherwise a lightweight tag is created.

Callers 1

TestDeleteBranchMethod · 0.80

Calls 2

ConfigMethod · 0.95
SetConfigMethod · 0.65

Tested by 1

TestDeleteBranchMethod · 0.64