Repository navigation
Confirm before theme pull overwrites or deletes local files - #8859
Draft
PhilippeCollin wants to merge 2 commits into
Draft
PhilippeCollin wants to merge 2 commits into
PhilippeCollin wants to merge 2 commits into
Conversation
`shopify theme pull` checked for uncommitted changes by running `git status` in the target directory. Git reads its settings from that directory, which isn't always trusted, so remove the check and avoid invoking Git on the pull target entirely. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
List the local files a pull would overwrite or delete and ask for confirmation before changing them. `--force` skips the prompt, and when prompting isn't possible the files are listed as a warning and the pull continues, matching the existing directory confirmation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
theme pulltheme pull overwrites or deletes local files
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
shopify theme pulloverwrites local files with the remote version and deletes local files that don't exist remotely. The only protection against losing local work was a prompt shown when the target directory was a Git repository with uncommitted changes. That check ran Git inside the pull target, only covered Git directories, and didn't say which files would be affected.WHAT is this pull request doing?
theme pullnow works out which existing local files it would overwrite or delete, lists them (up to 10, then "and N more"), and asks for confirmation.--forceskips the prompt.--nodeletekeeps deletions out of it.--no-input, multi-environment runs), the affected files are shown as a warning and the pull continues. This matches how the existing "not a theme directory" confirmation behaves in those cases, so CI pulls keep working.Behaviour change for reviewers
The previous prompt only appeared for dirty Git trees. The new one appears whenever a pull would change existing local files, whether the change came from local edits or from the remote. That's more prompts for interactive users, in exchange for covering non-Git directories and showing exactly what will change.
How to test your changes?
pnpm vitest run packages/theme/src/cli/services/pull.test.ts packages/theme/src/cli/utilities/theme-ui.test.ts packages/theme/src/cli/utilities/theme-downloader.test.tsshopify theme pull, and check the file is listed and nothing changes if you decline. Run again with--force, and check there's no prompt.🤖 Generated with Claude Code