Open iyalang opened 5 years ago
I encountered the same issue with DeleteBranch function. In fact, the same applies to CreateBranch function as well. It throws an error "branch not found".
Here is another way you can delete a branch, which is mentioned in the example programs as well:
branch := fmt.Sprintf("refs/heads/%s", branchName)
b := plumbing.ReferenceName(branch)
err = repo.Storer.RemoveReference(b)
if err != nil {
err = fmt.Errorf("error deleting branch: %s", err)
log.Println(err)
return
}
Hi! I'm trying to delete a local branch that is not present on the remote. I get an error
branch not found
when I run:(using just the name
template/test
doesn't work either) The branch I'm trying to delete is included in the list of branches.provides the following output:
I created
cfg := repo.Storer.Config()
to check whatcfg.Branches
contains. Surprisingly, this map has only the following element:&{global origin refs/heads/global 0xc0007fbf80}
. So other branches can't be deleted because they are not found in this config. Is there any way to delete the branch? Why is it not added to the config?