←back to thread

131 points tomschafer | 1 comments | | HN request time: 0.565s | source
Show context
CGamesPlay ◴[] No.42152656[source]
Since we're all giving replacements to this, nobody's mentioned my preferred one, so: use git add's patch mode. On a clean worktree, do the search/replace in bulk. Then use `git add --patch` to selectively add the good replacements and skip the bad ones. Finally, `git checkout -- .` to throw away all the bad ones. The nice part about this is that it's not much to remember. If you can make a global search and replace, and you can use `git add --patch` (which is useful loads of times), you can do a selective search and replace by combining them.

As far as this actual tool: the demo GIF is way too fast-paced to show what's going on. A better demo would maybe search "ring", have 10 or so results instead of pages and pages, and show how you can unselect "spring" matches which were unintentionally caught.

replies(3): >>42156267 #>>42160088 #>>42164463 #
1. fragmede ◴[] No.42156267[source]
be very careful with

    git checkout .
it will eat your changes changes if you yolo it.