I'm trying to replicate Subversion's $Id: $ feature with git. I know that I can use .gitattributes to set the ident attribute, which will allow me to embed the blob ID in a source code comment. That's the basic requirement, and I'm covered.
But I'm struggling to work out how I can make the ID useful in a practical sense. git log and git blame require a filename, so I can't use the ID with them. git show just shows the blob contents, but doesn't give any link to the commit.
What I'd like is, given a blob ID, to get the commit that created that blob. (Ultimately, to get git log or git blame data for the file, or to be able to check out a revision that contained that file).
I appreciate that commit history in a distributed system like git is more complex than subversion, but if I can get anything as a starting point, that would be sufficient. All I really need is to be able to demonstrate that given the source code, I can track back into the version control history.
 
     
     
    