My requirement is to add the last commit of branch 'A' to branch 'B'. I did some research and found out 'cherry picking' can be a good solution to this.I want to write a gradle task which will be doing this operation. So, I do something like this:
task CopyCommits() <<{
def grgit = org.ajoberstar.grgit.Grgit.open(dir: project.parent.projectDir)
grgit.checkout(branch: 'B')
'git cherry-pick 2133467'.execute().text.trim()
}
Branch A is my local branch. The above task doesn't perform the required operation.