开发者

how to detach alternates after git clone --reference?

开发者 https://www.devze.com 2022-12-19 19:05 出处:网络
I\'m using git clone --reference to reduce network traffic over a slow connection. Now, git-clone\'s man page points out the dangers of using this and suggests git repack -a to break the link, which

I'm using git clone --reference to reduce network traffic over a slow connection.

Now, git-clone's man page points out the dangers of using this and suggests git repack -a to break the link, which I'm doing immediately after the clone.

What I'd like to know is - after I've done the repack, is it then safe to just delete .git/objects/info/alternates or is there a开发者_StackOverflow中文版 proper git command to do this?

Thanks


Note that git clone now has a new --dissociate option that does this. It was added in Git 2.3: https://github.com/blog/1957-git-2-3-has-been-released

The option simply calls git repack -a -d and deletes .git/objects/info/alternates. So yes, it is safe. (Source: https://github.com/gitster/git/commit/d35c8027937546e6b22a2f28123f731c84e3b380)


OK, so I found out. The answer is yes, it is safe to delete alternates directly. And no, there is no git command to do this.

http://thread.gmane.org/gmane.comp.version-control.git/141161/focus=141199

I know it's not the done thing to answer your own question, but we have to move on!

0

精彩评论

暂无评论...
验证码 换一张
取 消