replace code-descriptive comments with method level comments
This commit is contained in:
@ -48,13 +48,12 @@ func Init(repoPath string, commit bool, gitName, gitEmail string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Set the default branch for the passed repo as "main"
|
||||
func SwitchToMain(repo *git.Repository) error {
|
||||
// Create and set the 'main' branch as default
|
||||
ref := plumbing.NewSymbolicReference(plumbing.HEAD, plumbing.ReferenceName("refs/heads/main"))
|
||||
if err := repo.Storer.SetReference(ref); err != nil {
|
||||
return fmt.Errorf("set reference: %s", err)
|
||||
}
|
||||
// Update the repository configuration
|
||||
cfg, err := repo.Config()
|
||||
if err != nil {
|
||||
return fmt.Errorf("repo config: %s", err)
|
||||
|
Reference in New Issue
Block a user