Skip to content

Commit

Permalink
Add explanation for the refspec format
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperMalachowski committed Oct 18, 2024
1 parent 8335af0 commit 5593687
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/github/bumper/bumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ func gitPush(remote, remoteBranch, baseBranch string, repo *git.Repository, auth
return nil
}

// Push the changes from local main to the remote
// Push the changes from local main to the remote.
// We need to use the + sign to force push the changes.
// We need refs/heads/* on the remote branch correctly push the branch using go-git.
// See: https://github.com/go-git/go-git/issues/712#issuecomment-1467085888
refSpecString := fmt.Sprintf("+%s:refs/heads/%s", localRef.Name(), remoteBranch)
logrus.Infof("Pushing changes using %s refspec", refSpecString)
err = repo.Push(&git.PushOptions{
Expand Down

0 comments on commit 5593687

Please sign in to comment.