src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 541 forks source link

Force option in push request? #1237

Open rogercoll opened 4 years ago

rogercoll commented 4 years ago

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?

pojntfx commented 4 years ago

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

rogercoll commented 4 years ago

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