{"thread":{"id":"11427","subject":"Why 'git commit --amend' generates different HEAD sha1 each time when no content changes","startedAt":"2007-12-30T10:56:26Z","lastAt":"2007-12-30T11:20:04Z","messageCount":3,"participants":["Ping Yin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64209","messageId":"46dff0320712300256g36e825a2g711d98b565e361f9@mail.gmail.com","threadId":"11427","inReplyTo":null,"subject":"Why 'git commit --amend' generates different HEAD sha1 each time when no content changes","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2007-12-30T10:56:26Z","receivedAt":"2007-12-30T10:56:26Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"AFAIK, commit sha1 is only determined by commit object content (say\nparent commit, tree sha1 and so on). So why 'git commit --amend'\nchanges the commit sha1 when no content changes as following shows.\n\n$ mkdir A && cd A && echo foo >foo\n\n$ git init && git add foo && git commit -m 'add file foo'\n\nCreated initial commit 8626800: add file foo\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 foo\n\n$ git commit --amend\nCreated commit 3591035: add file foo\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 foo\n\n$ git commit --amend\nCreated commit 3927d9a: add file foo\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 foo\n\n-- \nPing Yin\n"},{"id":"64211","messageId":"46dff0320712300319s72dfc865oc71463cfe4e20cd0@mail.gmail.com","threadId":"11427","inReplyTo":"1199012360.15996.6.camel@futex","subject":"Re: Why 'git commit --amend' generates different HEAD sha1 each time when no content changes","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2007-12-30T11:19:29Z","receivedAt":"2007-12-30T11:19:29Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Dec 30, 2007 6:59 PM, Matthias Kestenholz <mk@spinlock.ch> wrote:\n>\n> On Sun, 2007-12-30 at 18:56 +0800, Ping Yin wrote:\n> > AFAIK, commit sha1 is only determined by commit object content (say\n> > parent commit, tree sha1 and so on). So why 'git commit --amend'\n> > changes the commit sha1 when no content changes as following shows.\n> >\n>\n> The full commit includes a timestamp too, which changed. Try setting the\n> GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables, you should\n> get the same SHA-1 everytime.\n>\n\n\n\n-- \nPing Yin\n"},{"id":"64212","messageId":"46dff0320712300320n3d12edf9oedc36777a226528b@mail.gmail.com","threadId":"11427","inReplyTo":"1199012360.15996.6.camel@futex","subject":"Re: Why 'git commit --amend' generates different HEAD sha1 each time when no content changes","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2007-12-30T11:20:04Z","receivedAt":"2007-12-30T11:20:04Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Dec 30, 2007 6:59 PM, Matthias Kestenholz <mk@spinlock.ch> wrote:\n>\n> On Sun, 2007-12-30 at 18:56 +0800, Ping Yin wrote:\n> > AFAIK, commit sha1 is only determined by commit object content (say\n> > parent commit, tree sha1 and so on). So why 'git commit --amend'\n> > changes the commit sha1 when no content changes as following shows.\n> >\n> The full commit includes a timestamp too, which changed. Try setting the\n> GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables, you should\n> get the same SHA-1 everytime.\n>\n\nThanks. With 'git show --pretty=fuller', I find that commit date\nchanges each time and that author date keeps the same.\n\n\n\n-- \nPing Yin\n"}]}