Add "Fixup" option to the journal

b4ndolero 2 months ago • updated by c600g 1 month ago 6

For those who have to always clean up feature branch history before merging (commit squashing, reordering, splitting, etc)  it would also be handy to have the "Fix up" option which basically is a "squash this commit with parent keeping parent message only). My co-workers constantly use GitUp for this kind of history rewrite thing, it's ugly but very fast. Personally I'd rather have only one tool.

You already can squash commits easily in the Journal.

Can you please elaborate on your idea? You can already squash in the Journal. In which way will your proposal be different?

True. It's not really a big thing but consider we have a branch like (#2 is newest commit):

- commit 2: "trivial removal of silly whitespaces"

- commit 1: "important mother of all refactoring changes"

I want to do a fixup which means I want to "join" those two commits but keep commit 1 message which is the relevant one so I have to select 2 & 1, right-click and "Squash Commits...", then the pop up to confirm operation will show:

*Squash multiple commits*


trivial removal of silly whitespaces

important mother of all refactoring changes


   [Cancel]   [Squash commits]

Then I have to go in the edit area, select and remove the first comment (in this case it's just one line of the two we have but it could be a few more) and click [Squash commits]

If I had a "Fixup" or "Fixup with parent" option I could do it in one click (or maybe two if you there is a confirm popup), I don't care about the last or child #2 commit message.

Just have a play with GitUp if you haven't done so already, it's very handy if you do this kind of thing often.

What if the commit 1 is the one with a preparation change and commit 2 being the final feature's change with the appropriate message (a common situation for us)? Do you really suggest 2 different operations that differ just in the way messages are handled?

I understand this might not be everybody's workflow but it's a "standard" git feature:

git commit --fixup <#1>

and then

git rebase -i --autosquash

Whether what you currently have in smargit "Squash..." I think would be in my example

git rebase -i HEAD~2

So in your scenario you if you wanted to do a fixup you would have to swap the commit positions first but you might as well do it with a squash. The fixup would only make sense in my scenario I suppose.

fixup! with "Rebase Interactive From..." is working well in 18.1 preview 1 !  Thank you for adding that, I missed having it and used command line instead.