0

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.

4

1 回答 1

0

我无法在这里使用cherry-pick,因为我想将所有提交推送到另一个分支。这对我有用:

task PushChanges() <<{
 def grgit = org.ajoberstar.grgit.Grgit.open(dir: project.parent.projectDir)
'git push origin A:B'.execute().text.trim()
}
于 2016-11-15T05:59:07.500 回答