// MergeBranch merges headBranch into baseBranch in the given repository.
MergeBranch merges headBranch into baseBranch in the given repository.
// MergeBranch merges headBranch into baseBranch in the given repository .
func (r repo) MergeBranch(baseBranch, headBranch string) error {
	apiURI := fmt.Sprintf("/repos/%s/merges", r)
	mergeJSON := fmt.Sprintf(`{"base":"%s","head":"%s"}`, baseBranch, headBranch)
	resp, err := r.Client.MakeAPIRequestWithData(http.MethodPost, apiURI, []byte(mergeJSON))
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusCreated {
		return fmt.Errorf("HTTP %d for %s while merging branch %q into %q in repository %q", resp.StatusCode, apiURI, headBranch, baseBranch, r)
	}
	return nil
}
func ( r repo ) MergeBranch ( baseBranch , headBranch string ) error { apiURI := fmt . Sprintf ( " " , r ) mergeJSON := fmt . Sprintf ( `{"base":"%s","head":"%s"}` , baseBranch , headBranch ) resp , err := r . Client . MakeAPIRequestWithData ( http . MethodPost , apiURI , [ ] byte ( mergeJSON ) ) if err != nil { return err } defer resp . Body . Close ( ) if resp . StatusCode != http . StatusCreated { return fmt . Errorf ( " " , resp . StatusCode , apiURI , headBranch , baseBranch , r ) } return nil }
MergeBranch merges headBranch into baseBranch in the given repository.
MergeBranch merges headBranch into baseBranch in the given repository .