Skip to content

Comments

feat(config): add branch="any" option to configure fallback behavior#108

Open
AVGVSTVS96 wants to merge 1 commit intofolke:mainfrom
AVGVSTVS96:any-branch-fallback
Open

feat(config): add branch="any" option to configure fallback behavior#108
AVGVSTVS96 wants to merge 1 commit intofolke:mainfrom
AVGVSTVS96:any-branch-fallback

Conversation

@AVGVSTVS96
Copy link

@AVGVSTVS96 AVGVSTVS96 commented Oct 14, 2025

This PR adds a new branch="any" configuration option that enables more flexible session fallback behavior.

Why? I prefer to always fall back to a known session, I don't want a newly created branch to negate my previously saved sessions.

Changes

  • New config option: branch="any" allows sessions to fall back to the most recent session from any branch
  • Backward compatible: Default behavior (branch=true) remains unchanged
  • Smart fallback: Falls back to the most recently modified session file from any branch when current branch has no session

Configuration Options

  • branch = false: Single session per directory, not branch-specific
  • branch = true (default): Branch-specific session, won't fall back to other branches
  • branch = "any": Branch-specific session, falls back to any other branch if current branch has no session

Implementation

Added find_any_branch_session() function that:

  1. Finds all session files for the current directory across all branches
  2. Sorts them by modification time (most recent first)
  3. Returns the most recently modified session file

This is useful for workflows where you switch between branches frequently and want to restore your work even when the current branch doesn't have a saved session yet.

@AVGVSTVS96 AVGVSTVS96 changed the title feat: add branch="any" option to configure fallback behavior feat(config): add branch="any" option to configure fallback behavior Oct 14, 2025
This allows persistence to fallback to another branch's session if the
current branch doesn't have an available session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant