matanster matanster - 1 year ago 101
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?

Answer Source

Substituting CommitHash for the given commit hash:

git rev-parse $CommitHash^{tree}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download