Open MartyLake opened 1 year ago
I don’t know how they do it, but you can do "custom patch" of commits that you have already done.
Tig doesn't have dedicated support for this feature yet; I think it would be a nice feature.
In the diff view, pressing u
could add the selected hunk to a per-commit index. It should be possible to add this special index to an earlier or later commit, or create a separate commit for it.
For the time being, I suggest using git-revise, another 3rd party tool. I sometimes use these bindings to split commits:
bind generic avc >git revise --cut %(commit)
bind generic avC >git revise --cut %(commit) -- %(file)
the second one extracts only from the selected file (though that PR is not merged yet)
@krobelus Thank you very much, I never heard of git revise
before, will definitely try to use it !
Hey, I stumbled upon a demonstration of lazygit, most of it I could already do with tig.
There was this concept called "custom patch" https://github.com/jesseduffield/lazygit/wiki/Directly-Changing-Code-Stored-In-Commits#lazygit-solution , where one has this temporary diff space and shortcut command to apply the patch to a former commit.
If I had to do it with vanilla git, I would do
git add -p
, thengit diff --staged > patch.diff
, thengit rebase -i %(commit)
, then edit the TODO to edit this commit (this I don’t know how to do programmatically), thengit apply patch.diff
and finallygit rebase --continue
.I wonder how it could be emulated in tig, specifically this rebase interactive+edit todo in one script.
Best,