logoalt Hacker News

hetmantoday at 3:59 AM1 replyview on HN

You don't need to keep their hashes because git keeps them for you. If you realise too late that things went terribly wrong, you can get the pre-rebase hashes with "git reflog". (It can take a little getting used to knowing how to identify them quickly after a rebase but they're there.)


Replies

xelxebartoday at 4:52 AM

Better yet, git reset ORIG_HEAD or whatever is usually sufficient[0]. The reflog is the general solution, but git's magic references do provide quite a few niceties.

https://www.man7.org/linux/man-pages/man7/gitrevisions.7.htm...