Hacker News new | ask | show | jobs
by jmholla 82 days ago
The difference here is that git objects don't change. When you do a `git gc`, you do get new objects at new inodes, but they don't get written to the existing ones. Try this out and you'll see local git clones do indeed create hardlinks:

``` cd $(mktemp -d) git init test ( cd test; touch README.md; git add README.md; git commit -m "Test"; ) git clone test/.git test_clone find test_clone/.git/objects test/.git/objects -type f -printf "%i\t%p\n" | sort ```

You'll see the same inodes used in both clones.

1 comments

Yeah, but this only works for the immutable object store. The rest of the tree is still copied.

CoW and reflinks let you share everything, including the non-immutable paths, and even stuff like node_modules.