Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:04:10+00:00 2026-06-04T13:04:10+00:00

In the discussion amongst the comments in this libgit2sharp issue it was highlighted I

  • 0

In the discussion amongst the comments in this libgit2sharp issue it was highlighted I can create commits against the object database?

What is committing to the object database?

Why is advantageous over doing a normal git add and git commit?

I’m trying to import commit history from another source control system, SourceGear, into Git. At the moment my logic simply loops over the files in the other source control system, gets a certain version and its commit info and does a repo.Index.Stage and then repo.Commit. I’m assuming that is correct, should I use the object database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:04:11+00:00Added an answer on June 4, 2026 at 1:04 pm

    When working against LibGit2Sharp the standard way to commit is indeed the following workflow:

    using (var repo = new Repository("path/to/a/repository"))
    {
        // do stuff
    
        repo.Index.Stage("path/to/file1");
        repo.Index.Stage("path/to/file2");
    
        repo.Commit("This is my commit", ....);
    
        // more stuff
    }
    

    However, this requires a non-bare Repository: a repository with a working directory and an index.

    The Stage() call registers files from your working directory into the index. The Commit() call creates an immutable timestamped snapshot of the content of the index into the object database.

    Since version v0.9, LibGit2Sharp allows the direct creation of Commits into the object database without requiring to Stage() anything. In fact, this even works against bare repositories.

    Besides Commits, using the new ObjectDatabase API, one can create Blobs or Trees. Some samples of possible use can be found in the ObjectDatabaseFixture unit tests.

    What is committing to the obect database?

    In fact a Commit always ends up being stored into the object database. The new API exposes some lower level operations which may come handy in some advanced scripting operations.

    Why is advantageous over doing a normal git add and git commit?

    Wow… This is a broad sub-question. And there is not a finite list of answers 😉 Off the top of my head here are some potential answers:

    • This allows you to directly create Blobs and/or Trees independently of any Commit
    • Using the standard working directory -> index -> odb workflow, one can only prepare one commit at a time. Using this API, you could create Blobs and Trees in a non-sequential flow, then decide at the latest moment which Tree will be associated to a Commit.
    • This API also allows to explicitly select what parents the Commit to be created should bear
    • Git is a content-addressable filesystem, an immutable, append-only object database. This API facilitates other kind of usage than the standard source control one.

    At the moment my logic simply loops over the files in the other source control system, gets a certain version and its commit info and does a repo.Index.Stage and then repo.Commit. I’m assuming that is correct, should I use the object database?

    Considering your use case, it looks like the standard workflow is enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a discussion board, and users can post comments on the board. But
A discussion about Singletons in PHP has me thinking about this issue more and
A discussion amongst some colleagues emerged recently how in today's software industry, two separate
I see from this discussion , and the Nick Hodges blog , that the
Further to the discussion in Floating div issue in IE i added Floating div
The discussion in this question is the direct cause for me asking this question.
In discussion about my answer to this question , there was some disagreement over
I was having this discussion with my friend and realized this might be the
This discussion started over here but I thought it would be nice to have
This discussion suggests using a base controller and overriding OnActionExecuting . This one mentions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.