Local shallow git cloning with hard links

On my local file system, I want to be able to clone the git repo (A) head, so no history comes to a new repo (w)> w20>. But I want the advantages of hard links for files now in B to be preserved in space. Is there any way to do this? Do hard links help after repo changes?

Thank!

+5
source share
2 answers

It seems that local shallow cloning is not possible with tight connections between object databases, at least with git 1.7.12. git clone --depth 1 --single-branchexplicitly warns that it is --depthignored in local clones and used file://. Therefore, you will need to choose between hard links and shallow cloning.

Hard links work even if the repository changes at least temporarily because git adds new objects to new files and never modifies existing files. However, it sometimes repackages the object database to increase efficiency, and I don’t see how hard links can be saved.

, git clone --single-branch --depth 1 file://old_repo_dir. , , --depth 1 1 , , ( , ). , , .

, . , , . 664 673k ( Emacs bzr git). , 36 3477 , , -, . :

# at the old repo:
git checkout --orphan tmp-snapshot
git commit -m "Initial commit."

# at the new repo location:
git init
git pull OLD_REPO_DIR tmp-snapshot:master

# back at the old repo:
git branch -D tmp-snapshot   # no longer serves a purpose

master , - .

+6

, , . , , , , , . , - , gc , , , . .

git commit-tree, , .

+2

All Articles