Skip to content

Session System

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

Session System

Historical page (sr 6.x). It documents the Bash implementation, which sr 7 replaced with a Python rewrite and a different command line. Nothing below applies to 7.x; the page is kept for reference. Current documentation: Home, Installation, Quick-Start and sr help (27 topics). The text below is unchanged.

Manage complex replacement operations with named sessions.

Overview

Sessions provide complete audit trails and rollback capabilities for bulk replacements.

Creating Sessions

# Create a new session
sr --session "project-refactor" --find "old" --replace "new" --recursive ./src/

# Session with specific date
sr --session "2024-migration" --find "legacy" --replace "modern" /path/

Session Operations

List All Sessions

sr --session list

View Session Details

sr --session show "project-refactor"
sr --session show "project-refactor" --detailed

Session Statistics

sr --session stat "project-refactor"

Rollback & Recovery

Rollback Changes

# Revert all changes in a session
sr --session rollback "project-refactor"

# Rollback with confirmation
sr --session rollback "project-refactor" --confirm

Commit Changes

# Permanently commit session
sr --session commit "project-refactor" --message "Refactoring complete"

Session Properties

Property Description
ID Unique session identifier
Timestamp Creation date/time
Files Modified Count of changed files
Total Changes Total replacements made
Status active/committed/rollbacked
Audit Trail Complete change log

Best Practices

  1. Descriptive Names - Use clear, meaningful session names
  2. Review Before Commit - Always verify changes first
  3. Regular Cleanup - Archive old sessions periodically
  4. Backup Strategy - Combine with backup system
  5. Change Documentation - Add detailed commit messages

See Also

Clone this wiki locally