zlacker

[return to "Stacked Diffs with git rebase —onto"]
1. ptx+sif[view] [source] 2025-12-05 15:15:34
>>flexdi+(OP)
What I would really like is a Git equivalent to Mercurial's "fold" operation. I usually make a bunch of commits as I work, just as checkpoints, which I then want to turn into a single final commit when it's done, which could be quite some time later, e.g. "started on thing", "broke it", "broke it more", "Add thing to improve foo of bar".

Mercurial's "histedit" command offers two operations to combine the commits: "fold" and "roll", where "fold" brings the earlier commit into the later commit and "roll" does the reverse. The "fold" operation does exactly what I want in this case: It brings all the changes into the final commit from when I actually finished it, using the commit date of that commit.

Git's "rebase -i" command offers "squash" and "fixup" and "fixup -c" and "fixup -C", but they all do the same thing as "roll", i.e. they keep the earliest commit's date, the date when I started working on the thing and not the date when I finished working on it. (So I then cut and paste the correct date and update the commit afterwards. This may not be the best way to do it.)

◧◩
2. stevek+IQg[view] [source] 2025-12-05 22:39:35
>>ptx+sif
If you ever try out jj, both fold and roll exist as `jj squash`. You'd choose as the destination the change of the time you'd want to keep.
[go to top]