Hacker News new | ask | show | jobs
by ibotty 4873 days ago
as i said in my other comment. that will only work for idempotent things: if you like to change, say, ' to ", the workflow in the article works, but git add -p won't.
1 comments

I don't follow you. Any time I'm inspecting the diff to see if I made the change I want, staging the changes i want progressively and then discarding the rest has worked well.
the important part missing in my example is the 'vice versa'. the canonical example is:

> sledge() { tr ab ba < $1 | sponge $1 }

then, you might undo a change you already -p added.

more convincing might be (using gnu sed):

> sledge() { sed -i s/identifier/long_identifier/ $1 }

a second iteration will eventually generate long_long_identifier.