Skip to content

Session System

Mikhail Deynekin edited this page Dec 22, 2025 · 1 revision

Session System

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