+4
Completed

Add "Fixup" option to the journal

b4ndolero 2 years ago • updated by Jeff Jensen 2 weeks ago 16

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.

GOOD, I'M SATISFIED

Ok, thanks.

Satisfaction mark by b4ndolero 2 months ago

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.

+1

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.


So this ticket can be marked as fixed?

+1
Completed

In the log window of version 19.1 there is a "Use Message for Commit" command.

Yes, this has been helpful to save some typing, thank you!

Please also add this feature (same menu option or different one with "Copy message with fixup!" if difficult because it is a different window) to the "Log for" Graph window too.  It's where I almost always find the commit to fixup.

I've scheduled it for the Journal for v19.2. What exactly do you mean with "Log for" Graph window?

""Log for" Graph window" means the displayed window when choosing Log option on a file in Files view.

The File Log or Subdir Log windows do not allow to commit, so this command would be useless there.

Yes, they don't commit but they have messages to copy from, which is not useless.


The menu option on those windows could paste it in the Commit view or, as I mentioned if that's not acceptable because it is a different window, have a different menu option such as "Copy message prefixed with fixup!" would put it in the clipboard for user to easily paste.

There are too many commits in the Graph view to find the desired commit.  It is easiest to press Ctrl+L on a file in Files view, choose the desired commit in the Log for window, and choose Copy Message.  This is easier and faster than searching using the Graph Filter field, especially since option "File (expensive)" is off by default and there is no option to have it on by default, and once it's on, I'd still have to copy the filename from files view and paste into the Filter field.


My steps are to copy the message from the Log for window, close the window, (now I'm back on Commit view), type "fixup!", paste the message.

I do this a lot and looking to stop typing fixup!

https://smartgit.userecho.com/communities/1/topics/811-commit-dialog-add-convenience-paste-buttons-for-key-words



Thank you very much!  This exists on the Log for window in 19.1 RC2 and it works great.

I use "Use message for commit" all the time from the "Log for window", thank you for adding it!