Re: Commiting unchanged tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 18, 2010 at 08:15, Maaartin <grajcar1@xxxxxxxxx> wrote:
> I thought that calling
>
> git commit --amend -m "A message"
>
> twice in a row should lead to an error saying "nothing to commit (working
> directory clean)", but it doesn't. Or at least, the result of the second commit
> should be the same as the result of the first one, but I keep getting a
> different hash each time
>
> # git commit --amend -m "A message"
> [master b8cf1c2] A message
> # git commit --amend -m "A message"
> [master 6c8ea30] A message
> # git commit --amend -m "A message"
> [master be318b3] A message
>
> I wonder if everything is fine with my repo since I was doing some funny
> rebasing and filtering and I'm quite new to git.

This is expected behavior. You're telling Git to amend the latest
commit with a new commit message (which happens to be equivalent to
the old one), and your sha1 keeps changing because the `commiter` time
entry in the commit changes every time you commit (well, with a
granularity of 1 second):

    v foo (master) $ git commit --amend -m"blah"; GIT_PAGER=cat git
show --pretty=raw
    [master 9cc96c7] blah
     0 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 blah
    commit 9cc96c71ae30f94afaf891be58671a0adf89cedb
    tree c4bf67b477e5e7470266b4227a664f7b175c9d4a
    author Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 1284802065 +0000
    committer Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 1284802096 +0000

        blah

    diff --git a/blah b/blah
    new file mode 100644
    index 0000000..e69de29
    v foo (master) $ git commit --amend -m"blah"; GIT_PAGER=cat git
show --pretty=raw
    [master bc71b18] blah
     0 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 blah
    commit bc71b18ae254b33e895ee840825bf357baa40e00
    tree c4bf67b477e5e7470266b4227a664f7b175c9d4a
    author Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 1284802065 +0000
    committer Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 1284802097 +0000

        blah

    diff --git a/blah b/blah
    new file mode 100644
    index 0000000..e69de29
    v foo (master) $

Note the difference between 1284802096 and 1284802097 there.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]