reset

Resets the current branch to exactly match its remote counterpart.

Usage

git-wrangler reset [--repo <path>] [--yes] [--guided]

What it does

Discovers Git worktrees under the current directory, or targets exactly one worktree with --repo. For each repository, it fetches origin <current-branch>, checks whether origin/<current-branch> exists, and prepares a hard reset only when the local branch is ahead or behind.

Before resetting, the command shows a preview table with repository, branch, ahead/behind counts, and dirty state. It then prompts once for all reset candidates unless --yes is supplied.

Options

FlagRequiredDescription
--repo <path>OptionalTarget exactly one repository instead of discovering recursively.
--yesOptionalSkip the interactive confirmation prompt.
--guidedOptionalInteractively configure command options before execution.

Examples

# Interactive reset (shows divergence + prompts)
git-wrangler reset

# Non-interactive reset of divergent repositories
git-wrangler reset --yes

Notes

Warning: This is a destructive operation. All local commits and uncommitted changes will be discarded permanently.

  • Repositories already in sync with their remote are skipped
  • Repositories in detached HEAD state are skipped with a warning
  • Repositories whose current branch has no origin/<branch> counterpart are skipped
  • Dirty repositories are reset only when the branch is also ahead or behind