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 9188951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:08:08+00:00 2026-06-17T20:08:08+00:00

I performed the first commit and to see what the hash of the tree

  • 0

I performed the first commit and to see what the hash of the tree was I ran the command git cat-file -P HEAD which gave me the following output;

tree ac9b570150cca9243e1546f6c1b393f851dd7559
author pm 1358978176 +1300
committer pm 1358978176 +1300

I then proceed to add a new directory followed by a commit. I then ran the command git cat-file -p HEAD which have me the following output;

tree 297f145b042bf11f16ac39fa109df151a8d56ae3
parent dc2683fdf1bf9d5db5f1dc6fbb62576d10d57ae7
author pm 1358985313 +1300
committer pm 1358985313 +1300

I would thought that the parent hash was that of the preceding commit i.e. ac9b570150cca9243e1546f6c1b393f851dd7559. Have I not understood the use of parent hashes correctly?

  • 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-17T20:08:09+00:00Added an answer on June 17, 2026 at 8:08 pm

    ac9b570150cca9243e1546f6c1b393f851dd7559 is, according to your information, the hash of the previous tree, not the previous commit. You don’t show the initial commit id here, but git log will show it to you.

    For example, given:

    $ git log
    commit be2ddc1cdc0cbe0dad791712806b5c155fa357fc
    Author: Lars Kellogg-Stedman <lars@oddbit.com>
    Date:   Wed Jan 23 19:13:27 2013 -0500
    
        second commit
    
    commit 0e25b7e892bc6e637704909b3d66612807c8edc6
    Author: Lars Kellogg-Stedman <lars@oddbit.com>
    Date:   Wed Jan 23 19:13:03 2013 -0500
    
        initial commit
    

    We can run git cat-file -p HEAD:

    $ git cat-file -p HEAD
    tree cdbd58dcba3cf89422f444a310979f6b40dde1ad
    parent 0e25b7e892bc6e637704909b3d66612807c8edc6
    author Lars Kellogg-Stedman <lars@oddbit.com> 1358986407 -0500
    committer Lars Kellogg-Stedman <lars@oddbit.com> 1358986407 -0500
    
    second commit
    

    In this output, tree is the hash of the current tree, and parent matches the id of the previous commit.

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

Sidebar

Related Questions

is it possible to perform a first commit on a new repository using a
I have a topic branch ( new-http-api ) in git which is based on
git rebase does not appear to work properly in certain cases where a file
I have successfully created a database and performed my first migration using: class CreateUsers
I would like some feedback on my git workflow because this is my first
I was asked to perform(first time) a task in PHP with PostgreSQL for the
First off, I know there are many different easier/reliable ways to perform what I
maven release:perform is failing to distribute via FTP. The first thing I checked is
I performed a lot of search around this question, and do not find any
how to performed repeated task for a definite time like for 2 hours. Means

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.