找不到修订字符串的提交:

时间:2016-08-17 17:01:57

标签: git gradle grgit

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

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

但是当我执行任务时,我收到错误'找不到修订字符串的提交'。任何指针,我怎样才能使这项工作

enter image description here

stacktrace:

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

2 个答案:

答案 0 :(得分:0)

未找到修订字符串HEAD的提交 我遇到了这个问题。我已经完成了git init,但是没有提交或推送到存储库。所以我遇到了这个错误。

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

答案 1 :(得分:0)

对于未来的谷歌员工

我开始使用 semantic-release 并且我的项目使用以下格式的标签: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
    }
}