m

Reset a Git worktree to origin/main and refresh dependencies.

3|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/pedropaulovc/agent-plugins --skill m
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m
Source: https://github.com/pedropaulovc/agent-plugins/tree/main/plugins/worktree-reset/skills/m
Command: npx skills add https://github.com/pedropaulovc/agent-plugins --skill m

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

It solves the problem of a messy or drifted Git working directory by resetting your current worktree back to the exact state of origin/main, with optional cleanup and dependency reinstallation.

Core Features & Use Cases

  • Safeguarded reset flow: checks for uncommitted changes and untracked files, and asks before deleting uncertain untracked items.
  • Deterministic branch alignment: fetches/prunes remotes, removes stale local branches, resets the current branch to origin/main, and supports linked worktree branches.
  • Dependency refresh: runs npm install and go mod download when applicable, and can update all worktrees for consistent environments.

Quick Start

In your repo, run the m command to reset the current worktree to origin/main and reinstall dependencies.

Frequently Asked Questions about m

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reset my Git worktree to origin/main safely?

To reset a Git worktree to origin/main safely, fetch and prune remotes, check for uncommitted changes, optionally clean untracked files, perform a hard reset, and reinstall dependencies. This ensures your working directory matches the remote state without losing unexpected local files.

What is the best way to recover from botched local changes in a Git repository?

Recovering from botched local changes involves resetting the current Git branch to origin/main and cleaning stale local branches. The process checks for untracked files before executing a hard reset and refreshing npm or go dependencies to restore a consistent environment.

How do I clean stale local branches and fix Git drift?

To fix Git drift and clean stale local branches, fetch and prune your remotes to remove outdated references, then reset the current branch to origin/main. This aligns your worktree deterministically with the remote repository and resolves sync issues across linked worktrees.

Does a Git worktree reset also reinstall npm and go dependencies?

Yes, a Git worktree reset can reinstall dependencies by running npm install and go mod download when applicable. Refreshing dependencies after a hard reset ensures your local environment remains consistent with the updated origin/main codebase.

Can I reset linked worktree branches to origin/main simultaneously?

Yes, you can update linked worktree branches by resetting the current branch to origin/main and supporting linked worktree branches. This synchronizes multiple worktrees and ensures consistent environments across your local repository setup.

What happens to untracked files when resetting a Git worktree?

When resetting a Git worktree, the process checks for untracked files and asks before deleting uncertain items. It optionally performs git clean to remove them, ensuring your directory exactly matches origin/main while preventing accidental data loss.