Skip to content
KindDragon edited this page Mar 14, 2013 · 2 revisions

git-submodule

Get submodule commit

Get submodule head commit

Git

$ git submodule status <local path>

LibGit2Sharp

using (var repo = new Repository("path/to/your/repo"))
{           
    var submodule = repo.Submodules["submodule"];
    Console.WriteLine(submodule.HeadCommitId.Sha);
}

Get submodule index commit

Git

$ git submodule status --cached <local path>

LibGit2Sharp

using (var repo = new Repository("path/to/your/repo"))
{           
    var submodule = repo.Submodules["submodule"];
    Console.WriteLine(submodule.IndexCommitId.Sha);
}