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

  • Home
  • SEARCH
  • 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 6576227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:29:09+00:00 2026-05-25T15:29:09+00:00

I want to read from the file where git stores commit history to store

  • 0

I want to read from the file where git stores commit history to store each commit information in my project’s DB and display all histories in my project view

  • 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-05-25T15:29:10+00:00Added an answer on May 25, 2026 at 3:29 pm

    There’s no single file you can interrogate to get the commit history. There are plenty of good explanations of git’s object model (e.g. git for computer scientists, Pro Git, the git community book), but it might be useful to have a quick explanation here:

    There are various types of objects in git, most importantly:

    • blobs (files) – just binary files
    • trees (directories) – a tree is a list of other objects (usually blobs and trees) with their name, a hash and a limited set of permissions
    • commits (versions) – each commit includes the hashes of its parent commits, the author, the commit message and other metadata

    Each of these is identified by a hash of its contents, and this hash is known as the object name – these are the 40 digit hex strings you’ve probably seen in the course of using git. Each object is stored in the .git/objects/ directory, either as a loose object (one per file) or as one of many objects stored efficiently in a pack file. The file .git/HEAD represents the version that your repository is currently at, and usually contains a reference to a particular branch, represented by a file under .git/refs/heads or a reference stored in pack file. (HEAD may also point directly to a particular commit’s object name.) One of these files representing a branch, such as .git/refs/heads/master, just contains an object name.

    In order to traverse the history back from this branch tip, git will find the object named in that file in the object database, and recursively follow the pointers to its parents.


    However, for the use case you describe (i.e. traversing the history to export it), I would strongly suggest that you do one of the following:

    • Invoke git commands to find the history. If you stick to using the so-called “plumbing” commands, their output should be stable across git versions.
    • Use the libgit2 library to interrogate the repository. libgit2 is a fully re-entrant library for interrogating git repositories, which now has bindings for many languages.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read each line from a text file and store them in
I read from file store the data into a list; I want to add
I want to read from a file each line and edit only the lines
I want to read from a file and then delete it, all the while
I want to read lines from a file into a Set or List. Is
I want to read a file from a java web application. I don't want
I want to read line n1->n2 from file foo.c into the current buffer. I
In my grails application I want to read some values from properties file and
I want to read the file path from html input type=file (the entry selected
I want to read data about MMORPG characters from a .txt file and then

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.