News for hackers. Stuff that matters.
Re:Rewrite Git history via drag-and-drop by Pet_Ant on Tuesday December 03, 2024 @03:21PM (#42310864)
I want to be able to split a single commit into multiple commits. I sometimes mix clean-up changes with core logic changes in a single commit. That is something I'd pay for. To be able to just drag'n'drop the files from commit to commit. Especially if I could split changes within a file between commits. Something more powerful than the partial commits of Intellij.
Re:Rewrite Git history via drag-and-drop by Cykelero on Tuesday December 03, 2024 @04:18PM (#42311576)
I'm actually working on adding this to Retcon right now! It's one of the biggest feature requests.

So far the implementation goes like this: you enter Edit mode on a commit; you unstage some lines; and you confirm. The lines are yanked from the commit, and added to a new commit that you just have to title. I just use it on the Retcon repo and it's real cool to have.

Re:Rewrite Git history via drag-and-drop by corytheboyd on Tuesday December 03, 2024 @03:51PM (#42311250)
Lazygit patches are a great way to do this. You can interactively select lines from commits to “pull out” making them easy to form new commits with. Takes some getting used to, but it is the exact flow you are talking about.

https://github.com/jesseduffield/lazygit?tab=readme-ov-file#...

Oh you edited to say drag and drop. Lazygit is a TUI and patches are very much keyboard driven. Still worth thinking about? It’s free!

Re:Rewrite Git history via drag-and-drop by WolfeReader on Tuesday December 03, 2024 @03:33PM (#42311008)
(Assuming you haven't already pushed to remote)

Create a new branch, called "preSplit", at the commit where you want to split. Take your actual branch and reset it to one commit prior. Grab the first set of changes you want from "preSplit" and commit. Repeat until each distinct set of changes has its own commit. If needed, rebase commits after "preSplit" onto your current branch.

I'll do it for you, for a modest fee!

Re:Rewrite Git history via drag-and-drop by pimlottc on Tuesday December 03, 2024 @03:31PM (#42310977)
You can do this, via the command line at least, using `git rebase`:

https://stackoverflow.com/a/6217314

Re:Rewrite Git history via drag-and-drop by 3np on Wednesday December 04, 2024 @04:12AM (#42315770)
[delayed]
Re:Rewrite Git history via drag-and-drop by Zambyte on Tuesday December 03, 2024 @05:13PM (#42312171)
You may find Jujutsu appealing. Particularly the jj split subcommand.

https://martinvonz.github.io/jj/latest/cli-reference/#jj-spl...

Re:Rewrite Git history via drag-and-drop by rurban on Thursday December 05, 2024 @01:32AM (#42325564)
I do this constantly via the command-line in 5s. git fp, patch, git rebase