0
git cat-file -p master^{tree}

while this is straight from the pro git book, pg 226, it doesn't work for me. I just get back the command help text with no other errors or text:

D:\Users\jon\Documents\GitHub\FilePathContextMenu [master]> git cat-file -p mast
er^{tree}
usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
   or: git cat-file (--batch|--batch-check) < <list_of_objects>

<type> can be one of: blob, tree, commit, tag
    -t                    show object type
    -s                    show object size
    -e                    exit with zero when there's no error
    -p                    pretty-print object's content
    --textconv            for blob objects, run textconv on object's content
    --batch[=<format>]    show info and content of objects fed from the standard
 input
    --batch-check[=<format>]
                          show info about objects fed from the standard input
Jon
  • 29
  • 6

1 Answers1

2

Note that if you are using that line in a cmd prompt (with Git For Windows, since you seem to be on Windows, judging by your previous question), you will get:

fatal: Not a valid object name master{tree}

You would need to escape the ^, which in a cmd shell, is '^^':

C:\Users\vonc\prog\git\git>git cat-file -p master^^{tree}
100644 blob 5e98806c6cc246acef5f539ae191710a0c06ad3f    .gitattributes
100644 blob dc600f9b36d09f0668064e044520c7ce633f09d8    .gitignore
100644 blob 11057cbcdf4c9f814189bdbf0a17980825da194c    .mailmap
100644 blob 536e55524db72bd2acf175208aef4f3dfc148d42    COPYING
040000 tree 81319ed97d893e6e4afd37697ceac6be04e1a02b    Documentation
100755 blob 2b97352dd3b113b46bbd53248315ab91f0a9356b    GIT-VERSION-GEN

Note: git cat-file -p master^{TREE} won't work: tree must be in lowercase.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This is a good guess, but according to the question the OP got no errors, no "fatal: Not a valid object name master{tree}" message. –  May 18 '14 at 10:02
  • @VonC yes windows 7; using Git Shell (installed with GitHub). hvd is corrrect, no other messages. – Jon May 18 '14 at 10:49
  • @Jon are you in an empty git repo when you are executing that command? Or a repo with no commit yet? – VonC May 18 '14 at 10:50
  • @VonC repo is not empty and it has several commits. – Jon May 18 '14 at 10:55
  • @Jon Then git cat-file should work as advertised. Can you show us a screenshot of the command you are typing? – VonC May 18 '14 at 10:58
  • @Jon also can you try with the latest msysgit? (https://github.com/msysgit/msysgit/releases) – VonC May 18 '14 at 11:09
  • @Jon in your case, try `git cat-file -p master^{tree}` or even the double ^^^: `git cat-file -p master^^{tree}` – VonC May 18 '14 at 11:28
  • @VonC sorry, i'll fix the post, doesn't work with tree or TREE. I installed Git-1.9.2-preview20140411.exe and used "Git Bash" -- that works as expected. However, I have been using "Git Shell" (installed with "GitHub for Windows" which uses "Windows PowerShell"); it still shows git v1.8.4 (!) and does not work. Double ^ doesn't work there either. – Jon May 18 '14 at 11:37
  • @Jon true, GitHub for Windows does use its own git for Windows version. – VonC May 18 '14 at 11:38
  • @VonC I am new (can you tell) and this is confusing. If both are installed, why would "GitHub for Windows" use it's own version? Or why does one lag the other (I reinstalled GitHub for Windows just to make sure it was the latest -- v1.3.3.1.)? – Jon May 18 '14 at 11:46
  • @Jon GitHub for Windows is independent of any Git for Windows you might or might not have installed: it embeds its own version of Git For Windows, as I mention in http://stackoverflow.com/a/11928949/6309 , and http://stackoverflow.com/a/13290969/6309 – VonC May 18 '14 at 11:54
  • This was the answer I needed. Thanks – iCodeSometime Jan 24 '18 at 18:04