3 ms·
> the commit hash being a checksum of the commit contents will never change for the same commit It will if the parent changes, for example on a rebase. Now, it
by Sebb767 5y ago
> the commit hash being a checksum of the commit contents will never change for the same commit
It will if the parent changes, for example on a rebase. Now, it is up to discussion on whether that is a different commit (technically the parent hash is part of the commit), but most people probably consider the content changes to be the actual commit.
- deleted 5y ago[deleted]
- account42 5y agoThen most people are wrong. We already have a word for the content changes: a patch. A commit is a patch applied on a previous state. (Or for git, a snapshot with zero or more previous states if you want to be pedantic.)
- Sebb767 5y agoIf you google what is a git commit, almost nobody points this specialty out. This is also most likely what the above comment got wrong. So I don't disagree with you; if we're being pedantic, the commit hash never changes for the same commit [0]. I just pointed out that what someone without an in-depth knowledge of git would intuitively consider to be a commit can indeed have changing hashes. [0] There does not seem to be an authoritative definition for the git-type of commit, so I guess we need to go with "a commit is what git considers a commit".