git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Magnus Bäck" <baeck@google.com>
To: hong zhang <henryzhang62@yahoo.com>
Cc: git@vger.kernel.org
Subject: Re: how the commit ID come from in GIT?
Date: Mon, 5 Nov 2012 15:26:22 -0500	[thread overview]
Message-ID: <20121105202621.GA31625@google.com> (raw)
In-Reply-To: <1352145846.26267.YahooMailClassic@web141404.mail.bf1.yahoo.com>

On Monday, November 05, 2012 at 15:04 EST,
     hong zhang <henryzhang62@yahoo.com> wrote:

> Could anyone explain how the git commit ID will include all the files
> that devloper makes changes on?
>
> How git commit ID works?

In short, a Git commit points to a tree object that describes the full
state of the source tree plus metadata like the commit author, date,
description, and a pointer to the commit object(s) that preceded the
commit. The commit id itself is the SHA-1 of the contents of the commit
object. Any change of the source tree will affect the top-level tree
object's SHA-1 which in turn affects the SHA-1 of the commit. Also,
because a commit contains the timestamp of the commit object's creation
even two commits that are content-wise identical will have different
SHA-1s.

If you haven't read it, the Pro Git books explains Git's object model in
detail: http://git-scm.com/book/en/Git-Internals-Git-Objects

That description is quite detailed, and most users don't need to go that
deep.

-- 
Magnus Bäck
baeck@google.com

  reply	other threads:[~2012-11-05 20:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 20:04 how the commit ID come from in GIT? hong zhang
2012-11-05 20:26 ` Magnus Bäck [this message]
2012-11-05 23:04 ` Konstantin Khomoutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121105202621.GA31625@google.com \
    --to=baeck@google.com \
    --cc=git@vger.kernel.org \
    --cc=henryzhang62@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).