Skip to main content

rescue_command

Function rescue_command 

Source
pub fn rescue_command(path: &str, label: &str, now: &str) -> String
Expand description

The command that puts a work tree’s uncommitted work on a remote ref named rescue/<label>-<YYYYMMDD>: stage everything, commit it there, and push that commit to a branch of its own, so that the branch the work tree holds is not pushed over. The shape the two rescues of October 2026 took (origin/rescue/completion-doctrine-20261008).

use majordomus_cli::worktree::uncommitted::rescue_command;
let c = rescue_command("/r-wt/feature/x", "feature/x", "2026-10-08T10:00:00Z");
assert_eq!(
    c,
    "git -C '/r-wt/feature/x' add -A && git -C '/r-wt/feature/x' commit -m 'wip: rescue uncommitted work' \
     && git -C '/r-wt/feature/x' push origin HEAD:refs/heads/rescue/feature-x-20261008"
);