git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Why 'git commit --amend' generates different HEAD sha1 each time when no content changes

From
Ping Yin <pkufranky@gmail.com>
Date
Dec 30, 2007, 11:19 UTC
Message-ID
<46dff0320712300319s72dfc865oc71463cfe4e20cd0@mail.gmail.com>
In-Reply-To
<1199012360.15996.6.camel@futex>
On Dec 30, 2007 6:59 PM, Matthias Kestenholz <mk@spinlock.ch> wrote:
Show 11 quoted lines
>
> On Sun, 2007-12-30 at 18:56 +0800, Ping Yin wrote:
> > AFAIK, commit sha1 is only determined by commit object content (say
> > parent commit, tree sha1 and so on). So why 'git commit --amend'
> > changes the commit sha1 when no content changes as following shows.
> >
>
> The full commit includes a timestamp too, which changed. Try setting the
> GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables, you should
> get the same SHA-1 everytime.
>
-- 
Ping Yin
Previous: Ping YinNext: Ping Yin
Message 2 of 3 in “Why 'git commit --amend' generates different HEAD sha1 each time when no content changes”
  1. Ping YinDec 30, 2007
  2. Ping YinDec 30, 2007
  3. Ping YinDec 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.