Git criteria for comparing commits, why include a committer?

Git uses the SHA1 hash to identify the commit object, and according to the Git Book, the commit object contains:

  • wood
  • pointer to an older latch (parent)
  • time stamp
  • author's name
  • committer name
  • ...

What surprises me is the need for both the author and the committer in the commit object; indeed, this is a problem when combining the commit into another identical repository, as the commit hash will change!

My point is illustrated by GitHub , in your forks lineup you can even find your own commit after your changes have been merged with the original project! This, as a rule, is a “meta-conflict”, because the one who initiated the change is the same and who commits, should not change the nature of fixation ...

So why do you need it? Is it abuse by author and committer? I understand the need for both, I don’t understand why both should be included in the commit hash code , and why not somewhere else?

Is it possible to agree that the same change made in different repositories should be identified as the same, therefore, exclude the name of the committer from the hash?

+5
3

, , .

, , Git ; , , :)


: Git , . : (); , - - "", - " ". ( , Linux, : Linux , ​​ !


: ""

, , , , , , ( ) () ? , !

! , , . , [1]

, , ff (fast-forward). ! :

, ,

  • " "

, , - forks (refs to same commits) ( ... ) [2].

, , rebase ( ) ( ), ID, , . , , .

: ?

  • /

    • ; Git (.. ). git diff, git merge-base, git log rev1 ^rev2, Git ). (criss-cross, dow-tail ..) "" git. [3]

      • SKEPTICS: , , "". .

        • , ( , )
        • , ( )

.

  • , . git log --left-right --graph --oneline --cherry-pick BRANCH1...BRANCH2 , . manpage , :
  --cherry-pick
       Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric
       difference.

       For example, if you have two branches, A and B, a usual way to list all commits on only one side of them is with --left-right, like the example
       above in the description of that option. It however shows the commits that were cherry-picked from the other branch (for example, "3rd on b" may
       be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output.

[1] , , ...

[2] -: . sha1 tip (HEAD), , (a) (b) ( /) . git SCM, .

[3] . git log --merges --boundaries --decorate , rev1... rev2 ( , . man git-rev-parse)

+3

commiter , -, , . "", , . , , .

, , , , , , .

+6

, ; , git. , , , .

+3
source

All Articles