go-git icon indicating copy to clipboard operation
go-git copied to clipboard

Force option in push request?

Open rogercoll opened this issue 6 years ago • 2 comments

In options.go file there is the option to force for pull and fetch requests? Is there any reason why it is not implemented with push or just because it's a feature to develop?

rogercoll avatar Nov 05 '19 13:11 rogercoll

I just saw this as well, here is what I found to work:

err = g.Push(&git.PushOptions{
	RemoteName: GIT_REMOTE_NAME,
	RefSpecs:   []gitconf.RefSpec{"+refs/heads/master:refs/heads/master"},
})
if err != nil {
	panic(err)
}

This commit from 2017 gave me the hint: 38bd9e82fd3d83fd9a82678ec89227aeda2c3b78

pojntfx avatar Nov 26 '19 22:11 pojntfx

Thank you @pojntfx it seems it works. Nevertheless, I reckon that a force option should be implemented anyway.

rogercoll avatar Nov 27 '19 08:11 rogercoll