Skip to content

Quick Start

Mikhail Deynekin edited this page Oct 12, 2026 · 3 revisions

Быстрый старт

Quick start

Quick start

  1. Look before you leap:

    sr find "old_api" -p '.py' sr diff "old_api" "new_api" -p '.py'

    find shows file:line:col for every occurrence, diff shows the exact unified diff a replace would produce. Neither writes anything.

  2. Do it:

    sr replace "old_api" "new_api" -p '*.py'

    The scan phase counts the changes first; if more than 50 files would change you are asked to confirm. Originals are stored in a session under .sr/.

  3. Check and, if needed, undo:

    git diff # or: sr diff --session latest sr rollback # restores every file of the last session

  4. Useful variants:

    sr replace "old" "new" --dry-run # count only sr replace "old" "new" --interactive # confirm every hunk sr replace "old" "new" --write=dir -o out # write copies, touch nothing sr replace "old" "new" --json | jq . # machine readable sr replace "old" "new" -C ~/project # another directory

  5. Files are skipped for a reason. Add -v to see why:

    sr replace "old" "new" -v

    You will see "binary content", "ignored by .gitignore", "excluded directory (node_modules)" and so on.


Страница сгенерирована из встроенной справки sr 7.0.1 (sr help <topic>). Первоисточник — sr/help_system.py; он же питает man sr и sr help --all. Если страница и вывод sr help расходятся, верить нужно sr help: он всегда соответствует установленной версии.

Clone this wiki locally