0

我想将一个分支的更改添加到同一个 repo 中的另一个分支。我不确定这是否意味着将第一个分支合并到第二个分支中。所以,我尝试了这个

def grgit = org.ajoberstar.grgit.Grgit.open(dir: project.parent.projectDir)
    grgit.checkout(branch: 'test_dest')
    grgit.fetch()
    grgit.merge(head: 'master')
    grgit.push()

但是当我执行任务时,我得到一个错误'没有为修订字符串找到提交'。任何指针,我怎样才能使这项工作

在此处输入图像描述

堆栈跟踪 :

Caused by: org.ajoberstar.grgit.exception.GrgitException: No commit found for revision string: test_dest
    at org.ajoberstar.grgit.util.JGitUtil.resolveObject(JGitUtil.groovy:62)
    at org.ajoberstar.grgit.util.JGitUtil$resolveObject$0.call(Unknown Source)
    at org.ajoberstar.grgit.operation.MergeOp.call(MergeOp.groovy:84)
    at org.ajoberstar.grgit.operation.MergeOp.call(MergeOp.groovy)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at org.ajoberstar.grgit.util.OpSyntaxUtil.tryOp(OpSyntaxUtil.groovy:45)
    at org.ajoberstar.grgit.Grgit.methodMissing(Grgit.groovy:188)
    at com.vitalconnect.gradle.tasks.PushChangesTask.pushToDest(PushChangesTask.groovy:28)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 60 more
4

2 回答 2

0

No commit found for revision string: HEAD 我遇到了这个问题。我已经完成了 git init,但没有提交或推送到存储库。所以我收到了这个错误。

然后我提交并推送到正确的分支,然后这个错误消失了。

于 2019-12-05T07:52:00.003 回答
0

对于未来的谷歌人

我开始使用语义发布,我的项目使用这种格式的标签:1.0.0

该项目停止构建,并收到了我的信息:

> Could not resolve all dependencies for configuration ':project-name:classpath'.
   > No commit found for revision string: v1.0.0^{commit}

那是因为这个 gradle 插件接受的默认标签格式是v1.0.0

解决方案非常简单。只需将以下代码放入您的build.gradle

release {
    tagStrategy {
        prefixNameWithV = false
    }
}
于 2021-01-12T22:38:23.410 回答