From: "Michael" <>
I've got a file, with a diff/change, that I thought had already been checked into a previous commit. I want to see if this change exists in any checkin of that file.

Is there any way to ask for "all the checked-in versions of file X"? As far as I know, git only knows files by their sha hashes, and not by names -- which already tells me that there's probably something that I really don't understand about git.

Git does know about file names. but it keeps them separately from the content.

The content is the 'blob', each with it's own sha1, and identical content sharing the same sha1 blob (thing of all the COPYING and LICENCE files with identical content).

The filenames themselves is kept in the object called a 'tree' (conceptually similar to directory), and it lists all the [file]names to be used and the sha1's of their contents.

The tree can not only list the tracked files in a directory, but also list other trees (sub-directories) in the classic heirarchy.

A commit object lists just one tree as the sum total of the tracked files/dirs, along with the message and sha1's of the parent(s).

So, Git can search can search all the files at all of the revisions within the repo given the right command. e.g 'git grep'.
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to