0

I know that git stores files as SHA-1 hashes, but it also tracks the names of files.

In a bare repository where can I see this information.

For example I can look at the files in objects like this: Here is 4 files in my initial push under objects/

enter image description here

MrTux
  • 32,350
  • 30
  • 109
  • 146
cade galt
  • 3,843
  • 8
  • 32
  • 48
  • Git does not track filenames; https://git-scm.com/book/en/v2/Git-Internals-Git-Objects – MrTux Nov 28 '15 at 14:26
  • I've heard that but than how does it know when I change a file name than and push the file name change to my server ? – cade galt Nov 28 '15 at 14:27
  • See http://stackoverflow.com/q/7938582/3906760 – MrTux Nov 28 '15 at 14:28
  • 1
    File names are stored in tree objects, see the git internals link in @MrTux coment – kan Nov 28 '15 at 14:32
  • I was looking for the tree objects in my git bare repo but could not find them. – cade galt Nov 28 '15 at 14:35
  • not sure I understand the question do you want the files listed in the result of `git whatchanged your-sha1 -1` ? – OznOg Nov 28 '15 at 14:37
  • `tree object - lists the contents of the directory and specifies which file names are stored as which blobs. ` - this is take from git pro the book – cade galt Nov 28 '15 at 17:51

1 Answers1

0

You can issue

git cat-file -p HEAD^{tree}

This lists the (root) tree of your latest commit. The third column represents the object id. The first two chars of it represent the folder name and the rest the filename for unpackaged objects in .objects. Blob are files and tree is a subtree (a subfolder, you can see it by issuing git cat-file -p [OBJECTID]^{tree} where [OBJECTID] is the charsequence of the third column.)

(when using Windows you might need to replace ^ with ^^)

See https://git-scm.com/book/en/v2/Git-Internals-Git-Objects for more information how Git stores files and objects.

MrTux
  • 32,350
  • 30
  • 109
  • 146
  • `tree object - lists the contents of the directory and specifies which file names are stored as which blobs. ` - this is take from git pro the book – cade galt Nov 28 '15 at 17:51