本文介绍了为什么git revert告诉我“版本错误"?当我使用提交哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试恢复到较早的git commit,但收到错误错误修订".为什么?

I am trying to revert to an earlier git commit but get the error "bad revision". Why?

以下是成绩单(作者姓名已删除):

Here is a transcript (with author names removed):

Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master)
$ git status
# On branch master
nothing to commit, working directory clean

Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master)
$ git log | head
commit e3eb30cc7ca6d4cd10de755b63821cad75da1e83
Date:   Wed Feb 5 17:54:32 2014 -0800

    I changed my greeting.

commit 063ac580e28bab524286dac7b0a8f88d9e7d365f
Date:   Mon Feb 3 07:53:19 2014 -0800

Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master)
$ git revert 9e7d365f
fatal: bad revision '9e7d365f'

为什么我会得到不良修订",我该怎么办?我在Windows 7上使用git bash,而我的起源在github上.

Why am I getting "bad revision", and what should I do? I am using git bash on Windows 7 with my origin on github.

推荐答案

使用SHA1的简短版本时,使用的是前缀,而不是后缀.所以您实际上想说:

When you use the short version of a SHA1, you use the prefix, not the suffix. So you actually want to say:

git revert 063ac580

这篇关于为什么git revert告诉我“版本错误"?当我使用提交哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:25