zlacker

[parent] [thread] 2 comments
1. ptx+(OP)[view] [source] 2025-12-05 21:06:31
Hmm, I may have actually solved my problem. I think what I mostly want to do is this, if I'm working on the "feature-1" branch based on "main":

  $ git checkout feature-1
  $ git reset main
  $ git commit -a -C feature-1@{1}
This squashes all the changes and keeps the date and and message of the final commit on the branch.

Weirdly, although the "-c" and "-C" flags for the fixup operations sound like they should correspond to the same flags for "git commit", which grabs the date along with the message from the specified commit, the fixup flags only affect the message and not the date.

It would be nice if it worked the same for rebase as for commit. Then "fixup -C" would essentially correspond to Mercurial's "fold".

replies(1): >>WorldM+R6
2. WorldM+R6[view] [source] 2025-12-05 21:39:32
>>ptx+(OP)
Ah, yeah, that use of `git reset --soft` is how many places do squash merging, so that makes sense. You may want to make sure to include the `--soft` flag explicitly just as a precaution.

Also yeah, I would expect the fixup -c and -C flags to be more aligned with commit in a rebase.

replies(1): >>171862+2a
◧◩
3. 171862+2a[view] [source] [discussion] 2025-12-05 21:59:08
>>WorldM+R6
git fixup doesn't take the old commit message either, so I would be not so surprised that it doesn't take the commit message. It is really for preparing to do rebase fixup to the older commit.
[go to top]