Skip to content

Commit 5988804

Browse files
dev-ankitclaude
andauthored
Add -r shortcut for --rebase option in wt sync command (#17)
Added -r as a shortcut for the existing --rebase flag in the sync command. This provides a more convenient way for users to request rebasing during sync. Also added a test to verify the shortcut works correctly. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 20f6608 commit 5988804

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

tools/wt-worktree/tests/test_cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ def test_sync_command_with_rebase(runner, initialized_repo, no_prompt):
296296
assert result.exit_code == 0 or result.exit_code == 3
297297

298298

299+
def test_sync_command_with_rebase_shortcut(runner, initialized_repo, no_prompt):
300+
"""Test wt sync -r command (shortcut for --rebase)."""
301+
# Run sync with -r shortcut - will have no upstream but shouldn't crash
302+
result = runner.invoke(cli, ["sync", "-r"])
303+
assert result.exit_code == 0 or result.exit_code == 3
304+
305+
299306
def test_sync_command_invalid_args(runner, initialized_repo):
300307
"""Test wt sync with invalid argument combinations."""
301308
# Both include and exclude

tools/wt-worktree/wt/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def config(ctx: Context, key: Optional[str], value: Optional[str],
491491
@click.option("--all", "sync_all", is_flag=True, help="Sync all worktrees")
492492
@click.option("--include", help="Comma-separated list of worktrees to sync")
493493
@click.option("--exclude", help="Comma-separated list of worktrees to skip")
494-
@click.option("--rebase", is_flag=True, help="Rebase onto default base after pull")
494+
@click.option("-r", "--rebase", is_flag=True, help="Rebase onto default base after pull")
495495
@pass_context
496496
def sync(ctx: Context, sync_all: bool, include: Optional[str],
497497
exclude: Optional[str], rebase: bool):

0 commit comments

Comments
 (0)