Use merge operation in gradle (using grgit)


(sakshi) #1

I want to merge a branch into another branch in git using gradle git (grgit) plugin. The branch to be merged is first branch and branch into which the first branch is to be merged is second branch. So, I do a merge operation like this:

def grgit = org.ajoberstar.grgit.Grgit.open(dir: project.parent.projectDir)
grgit.checkout(branch: ‘origin/first’)
grgit.merge(head:‘origin/second’,mode: org.ajoberstar.grgit.operation.MergeOp.Mode.ONLY_FF)
grgit.push()

It builds fine but doesnot do any merge operation. Any idea?