Are the hashes for the tip of every branch sufficient to prove the integrity of my entire repository? For the sake of discussion, assume you had to give your whole repository to someone, let them do anything they want to it, and determine whether or not they changed even 1 bit of data. How would you do it?
If I'm pushing to an upstream, bare repository, is this all the data I need to guarantee I can verify the integrity of the whole repository at a later date?
git ls-remote --heads origin
fcce961b46784fae13be8a30c2622ddd34d970ec refs/heads/develop
9da7bb692a72235451706f24790a3f7a100a64e2 refs/heads/feature-netty-testing
86020c50d86691caecff4a55d3b1f2f588f6291d refs/heads/javafx-testing
871d715e5c072b1fbfacecc986f678214fa0b585 refs/heads/master
7ed641c96d910542edeced5fc470d63b8b4734f0 refs/heads/orphan-branch
That's from a sandbox repository I use to play around with. The orphan-branch
is a branch I intentionally orphaned as described here. Everything seems right to me. All the branches I expect are listed, but I'm not positive if the SHA of every branch tip is all I need. Am I missing anything?
What about tags? What about branches that were deleted without being merged into anything?
Updated
As pointed out in some comments, there may be other refs besides heads that may need to be considered. For example, tags
and notes
may be useful depending on whether or not they are important to you or whether or not you are signing your tags. For myself I am mainly interested in the content of commits which is why I accepted VonC's answer.