I prefer to have small and focused commits but don't always code that way. I've got a code section to the effect of
if abc:
def
etc
I edited def
and etc
, and the hunk in magit shows both as removed and then the edited parts as inserted.
@@ -1,3 +1,3 @@
if abc:
- def
-etc
+ ghi
+etc...
I want to make one commit with just the def
edit, but as it is it removes def
and inserts the new version after etc
when I select those lines manually.
How can I create one commit that results in code
if abc:
ghi
etc...
instead of
if abc:
etc...
ghi
Would committing the remove of def
and ammending with the add of ghi
be the only way to do it?