go - Merge current branch with upstream (or any other ref) in git2go -
i'm trying replicate outcome of following command in git2go:
git merge -x theirs --no-ff -m "commit msg" <commit> i'm able fetch upstream remote using remote.fetch(nil, nil, ""), cannot actual merge. code i'm using merging:
// upstream ref's annotated commit merge in head, _ := repo.head() upstream, _ := head.branch().upstream() annotatedcommit, _ := repo.annotatedcommitfromref(upstream) // prepare merge , checkout options mergeopts, _ := git.defaultmergeoptions() mergeopts.filefavor = git.mergefilefavortheirs checkoutopts := git.checkoutopts{ strategy: git.checkoutusetheirs, } // merge err := repo.merge([]*git.annotatedcommit{annotatedcommit}, &mergeopts, &checkoutopts) // no error here i understand after need check index conflicts, , commit 2 parents, i'm stuck here @ moment because merge() doesn't appear doing (no merge, no checkout).
checkout performing dry run default, able merge had use this:
checkoutopts := git.checkoutopts{ strategy: git.checkoutsafe | git.checkoutrecreatemissing | git.checkoutallowconflicts | git.checkoutusetheirs, } the documentation available in checkout.go source.
Comments
Post a Comment