Comment by CGamesPlay
9 days ago
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.
The `git gui` command is a nice-ish graphical alternative to `git add -p` and `git checkout` btw. You can even stage and discard individual lines. There are of course lots of other ones, but the TCL/Tk one is quite featureful.
Pretty neat trick, I will definitely use it in the future
But it only works in git repositories. Sometimes you need to search and replace on non-git repositories, for those cases Scooter might be the answer
be very careful with
it will eat your changes changes if you yolo it.