Re: [PATCH v5 0/4] history: add squash subcommand to fold a range
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 2, 2026, 12:54 UTC
- Message-ID
- <akZfm-igZKeHaDST@pks.im>
- In-Reply-To
- <3c35bd17-e884-432d-a400-36a89964ed89@gmail.com>
On Tue, Jun 30, 2026 at 03:01:43PM +0100, Phillip Wood wrote:
> On 30/06/2026 03:55, Matt Hunter wrote:
[?nip]
Show 14 quoted lines
> > This is probably a larger question, since (according to the man page) it > > affects the other 'git history' commands as well. When I run > > 'git history ...' and discover that I made a mistake after inspecting > > the results, is there a fool-proof way to undo the change and return to > > the previous state? My first thought was to run 'git reset --hard ...', > > but the default behavior of --update-refs (moving other branches) can > > make this more complicated. > > Yes this is a problem to which we don't have a good solution at the moment. > I believe Jujitsu and git-branchless both have some kind of operations log > that lets you revert a whole operation rather than just a single ref-update. > We'd need some way to tie all the ref updates from a single ref transaction > together either by logging the separately or adding some form of transaction > id to the reflog. That would be a big change.
Yeah, agreed. I think that the reflog is insufficient for a lot of Git's operations and that it is way too hard to reason about. It's both too detailed and not detailed enough at the same time:
- It provides way too much detail about individual reference updates
when all the user cares about is the high-level operation on the
logical level. - It does not provide enough detail to give information about what the
high-level operation even was.I don't think that we can fix the reflog to work properly in this case. But I certainly think that we should explore whether we can eventually introduce something like an oplog, as well, so that we can easily have the equivalent of `jj undo`.
It's something that I'd eventually want to get to, but it'll take a while. So if anybody else beats me to it then please go ahead :)
Patrick