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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:42:33+00:00 2026-05-17T06:42:33+00:00

As I understand it, a git commit object will always point exactly one tree

  • 0

As I understand it, a git commit object will always point exactly one tree object.

What I’m wondering is whether, in practice, this tree object is always guaranteed to be a git repository’s top-level tree object, representing the entire state of my code at the point the commit object was created.

Is there any chance, in an actual git repository, that any commit object could point to a tree object lower down in the hierarchy?

  • 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-17T06:42:34+00:00Added an answer on May 17, 2026 at 6:42 am

    Well, commits DO always point to the entire tree/branch history as it was at the time of commit, but you’re not limited to having just one history in your repository…

    You can have a branch for ProjectA and a branch for ProjectB (with completely different histories and sets of files) and using the subtree merge strategy, you can merge ProjectB’s changes into a subdirectory of ProjectA, keeping the history of ProjectB attached! Now, those commits from ProjectB’s branch history will still be in the root of their branch, but the merge commit will map them into a subtree of ProjectA. You can even re-merge when there are more commits in ProjectB to get the updates in ProjectA.

    Pretty confusing thing to do though, if you ask me… This Pro Git section suggests merging without keeping the history from the other branch, which seems a lot saner.

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

Sidebar

Related Questions

Possible Duplicate: git add -A, git commit in one command? If I understand correctly,
I understand that when I use git pull --rebase , git will re-write history
I am using http://nvie.com/posts/a-successful-git-branching-model/ As far as I understand, main repo in this model
I clearly do not understand git at all. This is what I'm getting: git
Question is similar to this (unanswered) and this one (same problem not involving Git).
Git uses SHA1 hash to identify a commit object, and according to the Git
Why is there the staging area between git add and git commit? I understand
In Git, I understand that a branch is a pointer to a commit. How
I'm starting to understand git but I'm still having some trouble with the abstraction.
I understand that Git can be used without a central repository. However, I am

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.