Have a coding agent work in a separate Git worktree when you want its edits kept out of your active checkout. A worktree gives the agent a distinct working directory, making independent or experimental tasks easier to review before you integrate them. It is code-workspace isolation, not a security barrier: it does not by itself restrict the agent’s commands, network access, or access to other files on your machine.
What a “copy” means in Git
A Git worktree is a separate working directory linked to the same repository. You can check out another branch there and let an agent modify that tree while your main checkout remains on its own branch and files. Git worktrees share most repository data; per-worktree details such as the current HEAD and index are kept separately. In other words, a worktree is not a full, independent clone, but it does separate the files the agent edits from those in your active checkout. See the Git worktree documentation.
As an Amazon Associate I earn from qualifying purchases.
When to use a worktree—and when not to
| Situation | Better fit | Why |
|---|---|---|
| The task can start from committed code, and its edits should stay out of your current checkout. | A separate worktree | You can review the agent’s changes separately and integrate them after you are satisfied. |
| The agent needs your current uncommitted edits, untracked files, or other files in the active project folder. | The current folder | A new worktree starts from committed files on its selected base branch; it does not automatically bring over those local files. |
| You want several independent agent tasks to proceed in parallel. | Separate worktrees or isolated agent sessions, where supported | Each task can work in its own checkout rather than changing the same active directory. GitHub describes isolated sessions for parallel tasks in its GitHub Copilot app agent sessions documentation. |
| You need to limit filesystem, network, or credential access. | Sandboxing or other permission controls | A worktree separates code edits, but does not enforce those operating-system-level restrictions. |
VS Code recommends using the current folder for small interactive tasks that should use the files already in the workspace, and a new worktree when changes should be separated from that workspace. Its agent harness documentation explains the distinction.
What a new worktree does—and does not—bring along
A managed worktree in VS Code requires a Git repository with at least one commit. When created, it starts from committed files on the base branch you select. Do not assume it includes your primary checkout’s uncommitted tracked changes or untracked files.
#1 Best Overall
- Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
- Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
- Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
- Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
- Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
Ignored files are also absent by default. That can include a local .env file or installed dependencies. VS Code documents options to copy ignored files and an experimental option to symlink them. A symlink points back to the original file or directory, so edits made through it affect that original location rather than providing an isolated copy. Check the VS Code documentation for the available worktree settings and their current status.
If the task depends on local setup, decide how to provide it before starting: commit the necessary non-sensitive files, recreate dependencies in the new directory, or use a deliberate copy or sharing method. Avoid copying secrets into an agent workspace unless your permission model permits it.
Rank #2
- Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
- Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
- Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
- Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
- From Sandisk, a brand professional photographers trust to take on assignments.
Create, review, and integrate the work
With Git, a straightforward approach is to create a branch and worktree for the task. For example, from the repository’s main working directory:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
git worktree add -b agent/task ../repo-agent-task main
This creates a branch named agent/task in a sibling directory named repo-agent-task, starting from main. Replace main with the intended base branch. The command requires that the named branch and directory be available; if the branch already exists, use an existing-branch form or choose another branch name. Point the agent at the new directory, not the active checkout.
Rank #3
- Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
- 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
- Data Security: Solid state drives S.M.A.R.T. health diagnostics and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
- USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
- Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
- Confirm the starting point. Check that the chosen base branch contains the committed code the task needs. Bring over or recreate any required local setup separately.
- Let the agent work in the task directory. Keep the agent’s instructions and tools pointed at that worktree, and do not treat the separate directory as a restriction on what commands it may run.
- Inspect the changes before integration. Review the diff, run relevant tests, and resolve any issues. A separate checkout makes review easier; it does not make generated changes automatically safe or correct.
- Integrate deliberately. Merge or cherry-pick the task branch, or use your normal pull-request workflow. GitHub Copilot sessions and Cursor’s worktree documentation likewise frame isolated work as something to review and bring into the main project.
- Remove the worktree when finished. After retaining or integrating any needed work, remove the linked directory with
git worktree remove ../repo-agent-task. Git documents this command and other worktree management details at git-scm.com/docs/git-worktree.
Isolation is not sandboxing
A worktree keeps ordinary edits in a different working directory; it does not limit the agent’s command execution or network access. VS Code explicitly distinguishes worktree isolation from those controls. If you need to limit which files tools can access, whether they can use the network, or which credentials are available, configure sandboxing or appropriate permissions separately. GitHub’s agent sessions documentation describes local sandboxing as a way to restrict filesystem, network, and credential access available to agent-run tools.
Choose the control that matches the risk: use a worktree to keep task edits away from your active checkout, and use sandboxing or permission controls when the agent’s capabilities also need limits.
Quick Recap
Best Value
- MADE FOR THE MAKERS: Create; Explore; Store; The T7 Portable SSD delivers fast speeds and durable features to back up any endeavor; Build your video editing empire, file your photographs or back up your blogs all in an instant
- SHARE IDEAS IN A FLASH: Don’t waste a second waiting and spend more time doing; The T7 is embedded with PCIe NVMe technology that brings fast read and write speeds up to 1,050/1,000 MB/s¹, making it almost twice as fast as the T5
- ALWAYS MAKE THE SAVE: Compact design with massive capacity; With capacities up to 4TB, save exactly what you need to your drive – from large working files to game data and everything in between
- ADAPTS TO EVERY NEED: Whether using a PC or mobile phone, count on the T7 for extensive compatibility²; It’s a true team player when it comes to heavy-duty application usage or file-saving
- HI RESOLUTION VIDEO RECORDING: Record Ultra High Resolution (4K 60fs) videos directly onto the T7 Portable SSD with your favorite camera or mobile devices; Supports iPhone 15 Pro Res 4K at 60fps video and more³
Rank #4
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




