-1

I don't see what I could be doing wrong, but on my Windows computer Git doesn't seem to recognize short revision hashes. I've made sure they're 7 characters. Here's what happens, diffing the history of a file named "compile":

Short revision (taking the final 7 characters from the revision):

C:\mydir>git diff 417864c 6cca022 -- compile
fatal: bad revision '417864c'

Long revision:

C:\mydir>git diff b91a07a79c919ea4b981a32597b84aa1f417864c 6b59a420837c38586180325f45e23ea35d7676d3  -- compile
diff --git a/bin/compile b/bin/compile
index 2a5f3dd..b81e4bc 100755
--- a/bin/compile
+++ b/bin/compile
[snip]

I'm not really sure what to check for. Any suggestions?

Stephen
  • 8,508
  • 12
  • 56
  • 96
  • *"taking the final 7 characters from the revision"* - why the *final* characters? – jonrsharpe Dec 20 '17 at 22:04
  • You can't take the **last** characters of a hash, you need to take from the **start**. – Lasse V. Karlsen Dec 20 '17 at 22:05
  • 2
    Possible duplicate of [In git, what is the difference between long and short hashes?](https://stackoverflow.com/questions/43665836/in-git-what-is-the-difference-between-long-and-short-hashes) – jonrsharpe Dec 20 '17 at 22:06

1 Answers1

2

I don't know where did you get the idea that the tail* of the hash is meaningful.

Try the head*:

git diff b91a07a79 6b59a4208

* edit - erm.. of course HEAD has its meaning in Git. I meant end of the string and beginning of the string, respectively.

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107