4 ms·
> 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 mes
by fragmede 12y 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 12y 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.