Re: Graphical tool to merge and reorder commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Le 19 août 2025 à 07:28, R. Diez <rdiez-2006@xxxxxxx> a écrit :
> 
> 
>> - `git rebase -i HEAD~11` (or so;-)
>> - move fixA1 and fixA2 under A and change "pick" to "fixup" for fixA1 and fixA2
>> - save and exit the editor
> 
> I actually did not want to count commits or look at hashes, I wanted to comfortably click around to see the diffs etc. while I make the decisions.
> 
> After such posts, I wish people like you had to buy their next online plane or train ticket with curl. }8-)
> 
> But let's stay on the command line. I could learn new tricks.
> 
> 
>> And done.
> 
> OK, git rebase was happy, everything is done.
> 
> And now it does not compile anymore.

Perhaps there were conflicts? Reordering patches doesn’t guarantee any semantics about the code :)

> 
> You'd want to go back to the initial commit sequence and try another approach. But now it's gone, or at least it does not come up anymore in your git-gui. Or is it really gone? Maybe I can dig up the old commit sequence if I find the right Git commands... But that is what I wanted to avoid in the first place!

Try “git reflog <branch>”: it will show you that old commit.

> So I guess I should branch beforehand, just in case. And then move the head back, and rebase the commits there. Or the like. And don't squash yet, just in case. And then squash later, after everything compiles. My keyboard is on fire.

Exactly: this is what I call “defensive Git.” The objects are immutable, so when you spoke of duplicating head to attempt upthread, the best way to do so is to write down the commit hash (e.g., by labelling it with a branch). That’s “all” you have to do to duplicate.

Then you can rebase or perform some other history rewrite, which creates a brand new set of objects. If happy, abandon the old hash (e.g., delete the branch, which notably does not immediately delete the objects). Or if not, reset to the old commit and try again.

PS Have you tried using something like “commit --fixup/squash” and “rebase --autosquash [@{upstream}]” (or possibly “@{push}”—upstream is the default)? For me that automates most of the typical reordering I would do, although again conflicts are a possibility. 




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux