I am trying to convert a Perforce(p4) repository to git (preferably to Helix4Git, a git server implementation by perforce).

I reduce my problem to a simple use-case in order to find the solution for my bigger problem.

In P4 I have one file //depot/foo.txt which is 10MB. I "cloned" it by using the merge command of P4 so I have the same file twice in my repository, called //depot/bar.txt.

    .. foo.txt (10MB) [internal-id==> 4509b9a8.txt]
    .. bar.txt (10MB, clone of foo.txt) [internal-id==> 4509b9a8.txt]

The P4 server stores the file once by using two links internally to reduce used disk space so just 10MB are used. On a local disk I would have two physical copies though (10+10=20MB). Now here is problem:

I use git-p4 to convert my P4 repository to git. First I clone it to my local computer, and then set a git-remote and submit everything to finally have it on my git server.

As mentioned earlier, I have 20MB on my local disk and when I submit it to my git server he uses 20MB as well.

1) If I clone a file in git, is it physically cloned on the server as well?

2) Is there any chance that git-p4 or the git server detects this "clone" - that it is the same file - and uses links internally as well? Either the git server itself or by using a file system feature (soft-link or hard-link, etc).

Extra Question) Would macOS APFS for the git server be of any help here?

Thanks a lot!


When you moved the cloned files into Git, they will be stored separately. Git only stores the file content and file permissions. Metadata and inode ID is not tracked.

Your best bet to add the clone to gitignore or .git/info/exclude

Reference: enter link description here

  • Thanks a lot! I don't want to ignore the files. I need them on my server. I am aware that git without extensions has some problems with big files but is is really that bad? We have ~200 branches with thousands of source code files with 1 MB of size. Several of them are plain copies so I try to find a workaround to not pollute the git server with physical unnecessary copies – Daniel Stephens May 27 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.