Search code examples
c#gitlow-level

Decoding Git index file using C#


Is there any documentation about internal structure of Git index file? From various book I know it's binary and it contains SHAs of staged files, I know about Git 'plumbing' commands helping to reveal index content...

But how about read index by myself using C#, for example?

I know that there several implementations of this feature, so it's possible to study the code:

  • In Git itself;
  • In libgit2 written on C;
  • In GitSharp ported to C# from Java.

And all these options a bit complex, because need to hack around other's code. I would prefer to develop from scratch using data format explanation. If it's possible of cause.

Would appreciate your help very much!


Solution

  • Take a look at Documentation/technical/index-format.txt in the git.git repository:

    http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/technical/index-format.txt;hb=HEAD