Git does create unique hashes for every commit. (theoretically there is a very small chance for collision, but that is very improbable).
As explained in this answer, git
uses the following information to generate the hash:
- The source tree of the commit (which unravels to all the subtrees and
blobs)
- The parent commit sha1
- The author info (with timestamp)
- The committer info (right, those are different, also with timestamp)
- The commit message
since the timestamp is integrated, you will never just have two same hashes for the same "content".
You can however have multiple references pointing to the same commit hash: tags, branches.
Conclusion
Depending on what you want you can:
- just use the git commit hashes, since they are unique for each commit. If two branches point to the same commit, you will analyze only once, but depending on your need that might not be necessary since it really is the exact same commit.
- you can combine the git commit hash with the branch name if you really want an analysis for each branch, even if they point to the exact same code.