matanster matanster - 6 months ago 36
Git Question

How to get timestamp-neutral git hash from a given commit hash


git write-tree
seems to provide a time-neutral hash of the current state of the project as staged, I am not sure how to get a time-neutral hash for a given commit. Motivation: getting one would be useful for testing different commits for equality ― regardless of the commit time or the commit message.

Is there a way for obtaining such a hash for a given commit? a hash that does not factor the time or commit message of the commit but only the tracked files' contents?


Substituting CommitHash for the given commit hash:

git rev-parse $CommitHash^{tree}