git如何清理克隆的存储库并重新克隆 [英] git how to clean a cloned repository and reclone
问题描述
我正在使用已克隆回购协议的USB,因此我可以在家中转移工作,反之亦然.USB多次出现问题并损坏了存储库.如果我尝试对其进行清理并重新克隆,则会显示所有旧(自)文件均已删除,所有原始文件均已修改.
I am using a usb that i have cloned my repo, so i can transfer my work at home and vice versa. Many times the usb has problems and corrupts the repository. If I try to clean it and reclone it shows all the old (self) files as deleted, and all the origin's files as modified.
我试图通过删除文件夹或重命名来清理克隆的存储库,或者事件delete .git和reclone,但是它仍然显示旧文件为已删除.有办法解决吗?
I tried to clean the cloned repo by deleting folder or rename it, or event delete .git and reclone but it still shows old files as deleted. Is there a way to fix it?
推荐答案
我真的建议为了拥有干净的回购版本,请 git bundle
手册页).
确保您也不要忘记捆绑包中的标签.
在" push vs. bundle vs.tar zcvf —备份整个本地.git ".
I would really recommend, in order to have a clean version of your repo, to make a bundle.
(See git bundle
man page).
Make sure you don't forget tags as well in your bundle.
Alternatives are discussed at "push vs. bundle vs. tar zcvf — to backup entire local .git".
这样,您只能在USB密钥上备份一个一个文件(并且可以从该捆绑文件中克隆/获取).
一个文件很难被破坏;)
That way, you get only one file to backup on your usb key (and you can clone/fetch from that bundle file).
One file is much harder to corrupt ;)
这篇关于git如何清理克隆的存储库并重新克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!