3 ms·
Yes, git does use hashes, but git similarly doesn't work in that manner for the same reason. Git commits can only point to commits in the past and not future co
by nanofortnight 11y ago
Yes, git does use hashes, but git similarly doesn't work in that manner for the same reason. Git commits can only point to commits in the past and not future commits. It is not possible to update old commits like you suggest.
The HEAD of a repository is like a pointer to the hash of a commit. You may think of HEAD like a repointable alias. `cat .git/refs/heads/master` in any of your git repositories to see what I mean.
- fragmede 11y ago> Git commits can only point to commits in the past and not future commits. Not true! With git time-travel, you can refer to a future commits in the commit message. Eg: $ git log --oneline HEAD~2..HEAD 9428c8c I am the child cdd3ab5 I am the parent of 9428c8 https://github.com/hundt/git-time-travel https://github.com/hundt/git-time-travel :p
- fordh 11y agoHa, that's a clever little tool! For anyone curious, this uses the same idea as the "guess-and-check" approach spullara mentioned: https://news.ycombinator.com/item?id=953569 https://news.ycombinator.com/item?id=953569 It changes the content of the commit (by iterating the hash in the commit message itself) until the hash of the child commit matches. A big part of the trick is that it only looks at a prefix of the hash, so the search space is much smaller than the full SHA1 hash.