git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC] git worktree: use filesystem cloning where supported

From
Peter Morris <mrpmorris@gmail.com>
Date
Aug 14, 2026, 10:40 UTC
Message-ID
<CAOqWQbKn88m=OBDF7W8bBPjeOxtRsvNmhsqNy9AryMKrOKtLUA@mail.gmail.com>
Hi,
I'd like to suggest a change to how git worktree creates files.

# Problem git worktree add creates a new working tree containing copies of the files from the existing working tree. This is normally fine, but it can result in a lot of unnecessary data being written to disk.

This seems increasingly relevant with AI coding harnesses. These often use Git worktrees to let multiple agents work on the same repository concurrently. If several agents are working on a large repository, each worktree can result in another copy of a large number of files being written to the SSD.

SSD storage is expensive, and SSDs also have a limited write lifetime. It seems wasteful to physically write the same data to disk several times when the filesystem may be able to avoid doing so.

# Proposed solution Where the filesystem supports copy-on-write or block cloning, could git worktree use it when creating the working tree?

For example, Windows Dev Drives (which I use) support ReFS block cloning. A file can be cloned without physically copying all of its data, with the filesystem sharing the underlying blocks until one of the files is modified.

If Git knows that the destination file will initially contain exactly the same contents as the source file currently in the folder, it seems like a good opportunity to use this facility.

The normal behaviour could remain unchanged on filesystems that don't support this or when the existing file is modified or a different version from the one that will be checked out.

# Why This would potentially:

* reduce SSD writes when creating worktrees, extending my SSD lifespan
* reduce physical disk space used by multiple worktrees
* make creating worktrees faster for large repositories
* be particularly useful when AI agents are creating multiple
worktrees concurrently

I'm not suggesting that Git should become dependent on ReFS or any particular filesystem. I'm wondering whether there is a suitable abstraction for filesystem-level cloning, with platform/filesystem-specific implementations where available.

I'd be interested to know whether this is something that would fit with the future plans for Git, and whether there are technical reasons why this couldn't work for worktrees?

Pete
Next: Kristoffer Haugsbakk
Message 1 of 8 in “[RFC] git worktree: use filesystem cloning where supported”
  1. Peter MorrisAug 14, 2026
  2. Kristoffer HaugsbakkAug 14, 2026
  3. Junio C HamanoAug 14, 2026
  4. Peter MorrisAug 15, 2026
  5. Kristoffer HaugsbakkAug 14, 2026
  6. Peter MorrisAug 14, 2026
  7. brian m. carlsonAug 15, 2026
  8. Peter MorrisAug 15, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.