7/26/2026 at 2:40:21 AM
After more than a decade of using git, I know that my comfort with rebase, and confidence that I wont make an error I can't undo, comes from knowing that I can always abort. And assuming it wasn't garbage collected, I can always get back to orphaned commits, or the commit before I rebased, as long as I keep their hashes. I can definitely look back on my less confident days as times when I wrongly assumed I was walking a tightrope where screwing up was painful and expensive, and easy to take the wrong path, and abort is the universal solvent to all of that.I do still find myself tripping up on whether the next appropriate step is to make a commit or continue the rebase, as that is dependent on if you're in a merge conflict or just editing a commit. But even when I get that wrong, and collapse two commits together, abort saves the day.
by flyingcircus3
7/26/2026 at 10:25:56 AM
This is a perfect use for tags. They allocate no extra storage space, and act as "savepoints" which you can refer to at any time. (Branches move, tags stay put.) They also guarantee that those loose ends are not garbage collected. Sometimes I delete a bunch of old ones, but any codebase of mine will at any time have a handful of old and probably useless tags. But that's ok.by xorcist
7/26/2026 at 12:39:57 PM
tags and branches are both just refs to the commit and can be used interchangeably for something like this. tags are not immutable, just in convention.by brown9-2
7/26/2026 at 7:41:43 PM
Annotated tags have their own commit I believe that is ehy you should use annotated tags for release tags.by conceptme
7/26/2026 at 3:59:52 AM
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.)by hetman
7/26/2026 at 4:52:11 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...
by xelxebar
7/26/2026 at 8:10:30 AM
> as long as I keep their hashesthat means my hashes or their hashes or them keeping my hashes, I am never sure
by janpeuker
7/26/2026 at 8:26:16 AM
you can just make a backup copy of .git or your entire project dir. When you get lost, just delete your .git, copy from the backup and try againby selckin
7/26/2026 at 9:28:23 AM
You never need to do that. git-reflog(1) is the most general solution if you will ever need.by delusional
7/26/2026 at 9:37:19 AM
Is this a joke? git's whole purpose is to save the history of your project and return to earlier versions when neededby herywort
7/26/2026 at 12:04:33 PM
It's a super simple solution for which you can be certain that you have all the knowledge needed to perform the restore operation.by Vinnl