DocsCommand reference
branch-switch
Check out another branch on a protected repo, optionally pulling after, without un-sealing files by hand.
Try it
SecretSleuth branch-switch --to main --pull
SecretSleuth branch-switch --to feature/invoices
SecretSleuth branch-switch --to main --pull --dry-run
How it works
[IronForge Secret Sleuth] branch-switch dry-run plan:
[would run] unfreeze + discard obfuscation on 2 protected file(s) (restore real content from current HEAD)
[would check] git status for remaining (genuine, non-obfuscation) local changes
[would run] git stash push -u -m "secretsleuth-branch-switch-<timestamp>"
[would run] git checkout "main"
[would run] git pull
[would run] git stash pop
[would run] SecretSleuth --repo "C:\repos\billing-api" --full-scan
If a protected file holds edits of your own, it stops before step one and changes nothing. Keep them with stage --all and a commit, or drop them with --discard-local-edits.
A conflict at git stash pop is a real one between your work and the branch. Resolve it like any stash conflict, then re-protect with --full-scan.
Options
| Flag | Description |
|---|---|
--to <branch> | Branch to check out. Optional with --pull: omit to pull the current branch |
--pull | Run git pull after checkout |
--dry-run | Print the planned sequence only |
--no-rescan | Skip the final re-scan (not recommended) |
--discard-local-edits | Proceed even when protected files hold your edits |
--repo <path> | Repository. Default: current folder |
Provide --to, --pull, or both. --pull without --to pulls the current branch.
Check the result
You are on the new branch, your genuine changes are back, and status shows the files protected again.