By marc2332
Drive marcgit (mg), a fancy git worktree manager: create/switch/prune worktrees and move in-progress edits into a fresh feature worktree.
A fancy git worktree manager. You call it as mg through a shell wrapper.
Projects live at <project>/trunk, and every other worktree (PRs, feature branches) lives as a sibling folder next to trunk:
myproject/
├── trunk/ # main worktree
├── feat-login/ # mg work feat/login
└── fix-typo/ # mg pr 42 (branch: fix/typo)
cargo install --git https://github.com/marc2332/git
Then wire the mg shell function into your rc:
# bash
eval "$(marcgit init bash)"
# zsh
eval "$(marcgit init zsh)"
# fish
marcgit init fish | source
# nushell — add to config.nu
marcgit init nushell | save -f ~/.config/nushell/marcgit.nu
# then: source ~/.config/nushell/marcgit.nu
The binary prints paths; the wrapper cds to them. Same trick zoxide and direnv use.
mg pr requires gh (GitHub CLI) to look up the PR's branch name.
| Command | What it does |
|---|---|
mg new <name> / mg n | Create ./<name>/trunk and git init it. Jump in. |
mg clone <url> <name> / mg c | Clone a repo into ./<name>/trunk. Jump in. |
mg work <branch> / mg w | Create (or jump to) a sibling worktree for <branch>. Creates branch if new. |
mg pr <number> / mg p | Fetch the PR via gh, create a worktree named after its head branch, jump in. |
mg trunk / mg t | Jump to the project's trunk from any sibling worktree. |
mg list / mg l | Print git worktree list for the current project. |
mg remove <branch> / mg r | Remove the worktree and delete its branch. Jump back to trunk. |
mg prune <days> | Remove sibling worktrees whose last commit is older than <days> days. Asks for confirmation; skips worktrees with modified or stashed files. -n / --dry-run to preview. |
mg init <shell> | Print the shell wrapper for bash / zsh / fish / nushell. |
mg config init | Write a default marcgit.toml at the project root. Print its path. |
mg config path | Print the path of the marcgit.toml reachable from the current directory. |
mg new myproject # → ./myproject/trunk
mg clone https://github.com/user/repo.git foo # → ./foo/trunk
mg work feat/login # → ./myproject/feat-login (branch feat/login)
mg pr 42 # → ./myproject/fix-typo (PR #42's head branch)
mg trunk # → ./myproject/trunk
mg remove feat/login # removes worktree + branch
mg prune 30 # prune worktrees idle ≥ 30 days (asks first)
mg prune 30 -n # dry-run: just list what would be pruned
feat/login → feat-login. No nested subfolders.mg work and mg pr are idempotent: if the worktree already exists, they just jump.mg pr requires gh (GitHub CLI) to look up the PR's head branch name.mg prune measures age by each worktree's last commit date (git log -1). It refuses to remove worktrees with uncommitted changes, untracked files, or stashes recorded against their branch.Optional marcgit.toml at the project root (next to trunk/). mg config init writes the default:
init-submodules = true # pull submodules on `mg work` (default: true)
Every command other than new, clone, and init needs to know which project you're in. It runs git worktree list --porcelain and picks the worktree whose folder is literally named trunk. That's the anchor — so don't rename it.
MIT © Marc Espín Sanz
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub marc2332/git --plugin marcgitFreya Rust GUI framework best practices skill for Claude Code
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Frontend design skill for UI/UX implementation
Comprehensive UI/UX design plugin for mobile (iOS, Android, React Native) and web applications with design systems, accessibility, and modern patterns
Memory compression system for Claude Code - persist context across sessions
Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth
Standalone image generation plugin using Nano Banana MCP server. Generates and edits images, icons, diagrams, patterns, and visual assets via Gemini image models. No Gemini CLI dependency required.