Get git SHA1 hash of change set (or diff) in commit

I basically integrate the branches of the finished theme into the main development branch, in git. In this case, I sometimes have to change the commit message (improvement, spelling correction, ...), which leads to a new commit with a new identifier SHA1.

I would like to get the SHA1 hash from a commit change . This will allow us to check if any content of the change set has changed or not after modifying the commit message.

It would be great if we could get the SHA1 hash of the set of changes to the sequence of commits . Then we could do interactive permutations where we squash the commits, and still end with the same SHA1 change set hash.

+3
source share
2 answers

When git needs to be specified whether a patch has been applied, for example. for git cherryit uses git-patch-idto create the hash of the patch introduced by this commit. Perhaps this will suit you, what do you want? Or maybe git cherryalready doing what you want? The documentation for these commands:

+2
source

You can get the SHA1 hash of the tree of specific commit points with

git show -s --pretty=format:%T master

where masteris any commit specification.

Note that git does not track the set of changes, it tracks the entire repository, so this tree identifier represents the state of the whole repository after this commit, not the changes that were added by this commit.

+1
source

All Articles