sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
271 stars 14 forks source link

"Squash with Parent" should use parent's commit message first instead of child's #1782

Closed nikhil-marathe-skydio closed 1 year ago

nikhil-marathe-skydio commented 1 year ago

Problem description

When squashing a commit into its parent using the Sublime Merge context menu option, the commit message ordering is reversed in a way that is not intuitive with how Git itself and other git clients work.

e.g.

  1. Commit A (with the commit message being something super nice and detailed, ready for review).
  2. Commit B (with some useless commit message since i'm going to discard it) is a descendant of A that I just made to fix up a tiny issue with commit A and I'm not going to squash.
  3. Right click on B and select "Squash with Parent".
  4. Expected: The squashed commit has Commit A's message (preserving the commit title) and then commit B's message. This is what the official git interactive rebase will do, as will other git clients. So the commit message will look like
nice commit title

nice commit message

squash
  1. Actual: Sublime Merge reverses this
    
    squash (nice title is now lost, leaving me confused about the squash)

nice commit title (has now become part of the commit message)

nice commit message



So I have to now go and edit the commit message of the new commit to fix the problem.

Some notes:
1. You may ask why I didn't "amend" my change into A directly? This is just an example. Generally A is not `HEAD`, so I will create B several commits down, then move it in the commit graph, then squash.
2. https://github.com/sublimehq/sublime_merge/issues/236#issuecomment-439107595 I just found out about this, where there is an option to ignore new messages. That fixup behavior is also different from what Sublime Merge is doing for squash. This is a reasonable workaround for me right now, but I've to remember to use this specific workflow for squashing.

**Preferred solution**

Follow convention and put commit B's message _after_ commit A's.

** Sublime Merge version **
=== App Version Information ===
Build: 2083

=== Git Version Information ===
Using Git: git (system)
git version 2.40.0

Platform: Ubuntu Linux 18.04
dpjohnst commented 1 year ago

Hi @nikhil-marathe-skydio,

Thanks for reporting this! We'll be looking into this further.

Cheers, - Dylan from Sublime HQ

themilkman commented 1 year ago

I am often in the same situation. Moreover, I just noticed that the resulting, merged commit (relevant commit A and the commit B which I want do melt in without keeping its message) has the author date of B instead of A. For my understanding this is not desired.

dpjohnst commented 1 year ago

Hi all,

Sublime Merge 2086 (development build) has been released which fixes this. This fix will also be available in the next stable build.

Kind regards, - Dylan from Sublime HQ