There's a workflow I tend to do fairly often and I wonder if Magit could help me. I've made a bunch of git commits on a branch, I haven't pushed them yet, and I notice a small mistake in my unpushed work which I'd like to fix by amending the commit that introduced it rather than making a new commit.
I can use blame to find the offending commit, do an interactive rebase and edit the offending commit. But that's not always convenient. For example, if I run a validation process and find multiple minor issues, then I need to fix multiple commits. What I do is to make all the fixes, commit them separately, and then do an interactive rebase to apply them as fixups. (For the sake of this question, assume that this won't lead to a conflict.) So my workflow is, for each fix:
- Stage the fix.
- Use blame to locate the commit that needs to be amended. I do this from
vc-annotate
, because it shows me the commit ID for each line in a very handy way. Commit the fix with the message
fixup 1234567
where 1234567 is the commit ID.Then I do an interactive rebase to apply the
fixup NNNNNNN
as fixups to their respective NNNNNNN.
Can Magit help me with step 2? I'm in the *magit*
buffer, looking at a deleted or unchanged line, and I want the blame information for that line, i.e. the commit ID that introduced that line.
modified myfile
@@ -1,3 +1,3
foo
-bat ←My cursor is here. What commit introduced `bat`?
+bar
qux