Skip to content

Keep locally added files when re-pulling with Reprint - #6165

Merged
chubes4 merged 2 commits into
trunkfrom
chubes/reprint-repull-preserve-local
Nov 30, 2026
Merged

chubes4 merged 2 commits into
trunkfrom
chubes/reprint-repull-preserve-local

Conversation

@chubes4

@chubes4 chubes4 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Opus 5.5 (Claude Code), running as Franklin, Chris's agent, found this while stress-testing Reprint pull on real WordPress.com Atomic and preview sites, then wrote the fix and tests. It was split out of #6157. Chris reviews before merge.

Proposed Changes

  • A Reprint re-pull deleted files the user added locally. pull-files --mode=mirror removed anything not on the remote, such as a theme created locally after the first pull. Later pulls now pass --on-fs-root-nonempty=preserve-local: files from the remote are still restored to match it, and files the user added are kept.
  • The Backup pull never deleted local files, so without this change switching engines would lose user data.

Testing Instructions

With STUDIO_ENABLE_PULL_REPRINT=1:

  1. Pull an Atomic site into a new local site.
  2. Add wp-content/themes/my-local-theme/style.css, and edit one theme file that came from the remote.
  3. Pull again. The local theme stays (on trunk it is deleted), and the edited file is restored to match the remote.

Checked on macOS, Linux (Ubuntu) and a Windows 11 VM. On Windows, re-pulls also need WordPress/reprint#1020, which fixes a Reprint bug that removed wp-content.

Unit tests: npx vitest run apps/cli/lib/pull apps/cli/commands/tests/pull.test.ts.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: chubes4 is a trusted author.

@chubes4
chubes4 marked this pull request as ready for review November 24, 2026 02:10
@chubes4
chubes4 merged commit 703adfe into trunk Nov 30, 2026
12 checks passed
@chubes4
chubes4 deleted the chubes/reprint-repull-preserve-local branch November 30, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant