Git Integration
When your themes or plugins live in git repositories, Rudel integrates with git automatically. Instead of copying files into the sandbox, it creates a git worktree on a dedicated branch. This means changes made in the sandbox are regular git commits that can be merged back via a pull request.
How it works
When you create a sandbox with --clone-themes or --clone-plugins, Rudel checks each theme and plugin directory for a .git folder. If it finds one, it creates a git worktree in the sandbox's wp-content on a new branch named rudel/{sandbox-id}. Directories without git are copied normally, and uploads are always copied since they're not typically version-controlled.
wp rudel create --name=feature-x --clone-themes --clone-pluginsIf your theme at wp-content/themes/my-theme is a git repo, the sandbox gets a worktree at wp-content/rudel-sandboxes/feature-x-a1b2/wp-content/themes/my-theme on the rudel/feature-x-a1b2 branch.
Working in the sandbox
From the sandbox's theme directory, you're on a regular git branch. You can commit, push, and create pull requests just like any other feature branch.
cd /path/to/sandboxes/feature-x-a1b2/wp-content/themes/my-theme
git status
git add .
git commit -m "Add new template"
git push origin rudel/feature-x-a1b2AI coding agents working in the sandbox can commit their changes directly. The sandbox's CLAUDE.md includes the branch name so agents have the context they need.
Merging and cleanup
Once the branch is merged into main, the sandbox has served its purpose. Instead of manually destroying it, run:
wp rudel cleanup --mergedThis checks every sandbox that has git worktrees. If all of a sandbox's branches have been merged into the default branch, the sandbox is destroyed, the worktrees are removed, and the branches are cleaned up.
To preview what would be removed without actually deleting:
wp rudel cleanup --merged --dry-runWhat gets git-tracked
Only themes and plugins are eligible for git worktrees. The decision is per-directory: if wp-content/themes/my-theme/.git exists, that theme gets a worktree. If wp-content/themes/other-theme/.git doesn't exist, that theme is file-copied. Uploads are always file-copied.
The database side of the sandbox (posts, options, settings) is not part of git. That's the disposable part. The code changes in themes and plugins are the part that should be preserved, and git handles that naturally.
GitHub integration (no git binary needed)
On shared hosting where git isn't installed, Rudel can work with GitHub directly via the REST API. This gives you the same branch-based workflow without any local git binary.
Define your GitHub token in wp-config.php:
define( 'RUDEL_GITHUB_TOKEN', 'ghp_your_token_here' );Then push sandbox changes to GitHub and create PRs:
# Push theme changes to a branch on GitHub
wp rudel push my-sandbox-a1b2 --github=owner/my-theme --dir=themes/my-theme --message="Add header template"
# Create a pull request
wp rudel pr my-sandbox-a1b2 --github=owner/my-theme --title="New header template"Rudel creates the branch (rudel/{sandbox-id}), uploads all files via the GitHub API, and opens the PR. When the PR is merged, wp rudel cleanup --merged detects it and destroys the sandbox.
This works on any host that can make outbound HTTPS requests, which is essentially all of them.
Without git
If none of your themes or plugins are git repos and you don't use GitHub integration, these features do nothing. Sandboxes work exactly the same as before, with plain file copying. Git and GitHub integration are purely additive.