Thanks for the pointer!  Looking at the git-notes documentation, I'd prefer 
to not use notes if they're tied to commits.  (In my case, these objects 
are private metadata to the git extension I'm writing, so I'd prefer not to 
attach it to a commit where someone might confuse it with actual repo 

Then I noticed this line, which looks promising:

It is also permitted for a notes ref to point directly to a tree object

So, I'll see if I can do that...thanks!


P.S.  FWIW...if anyone reads this later and is looking for other examples 
of tools that store extra stuff in .git/, the git-p4 tool stores its 
branches in.git/refs/remotes/p4, even though there isn't *really* a remote 
named p4.

On Monday, November 25, 2013 12:25:49 AM UTC-8, Thomas Ferris Nicolaisen 
> On Monday, November 25, 2013 2:50:31 AM UTC+1, Mickey Killianey wrote:
>> Does anyone know where I can store extra resources of my own in the .git 
>> directory?  I'm writing a git extension with some fairly expensive analytic 
>> computations that I'd like to cache, so that partial results can be reused 
>> across multiple invocations.
>> I was hoping to find some kind of "userspace" in 
>>  my git extensions can save items that shouldn't be associated with a 
>> commit/branch/tag.
>> For example, if I have a results file, would it be reasonable for me to 
>> add it the object store using git-hash-object, and then put the SHA1 of 
>> that blob in .git/refs/blobs/my-cached-results?  Or, if I have several 
>> different files I want to save, could I bundle them under a tree object 
>> (presumably using git-write-tree), and save that SHA1 to 
>> .git/refs/trees/my-cached-files?  Assuming that the files were the standard 
>> format of 40 hex characters plus newline, would this be sufficient to 
>> protect the trees/blobs from garbage collection?
> Have a look at git-notes: 
>> Or am I better off *not* using the object store?  If I should just write 
>> results into a file somewhere under the .git directory, is there a 
>> recommended place to put such things so that I'm relatively unlikely to 
>> collide with future git features?
> This depends on what your needs are. Obviously, if things are not in the 
> object store, they can't be conveniently pushed or pulled to other 
> repositories. As far as I know, there's no convention on this (the only 
> example I can think of is git-svn which creates and stores stuff inside 
> .git/svn), but if your files are not really related to Git core itself, I 
> would rather put them in some directory outside the .git/ folder and then 
> ignore it with .gitignore. 

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