如何找到并备份您的本地 GIT 存储库以便以后能够恢复它?
How to find and backup your local GIT repository to be able to restore it later?
我的本地 GIT 存储库在哪里?如果以后需要到同一台计算机或另一台计算机,我可以备份和恢复它吗?
更新:
抱歉,更清楚地说,我的 Mac 弹出一条消息,上面写着 "You haven't backed up in 12 days" 我想 "the only thing that has changed on my computer since then is the code in my project. I wonder if I can backup my local git repository to a USB drive and if anything happens I can restore it later if I need to, to another computer. Also, I haven't committed all of my changes."
Git 的 "repository" 存储在项目的隐藏 .git
文件夹中。您可以备份、恢复、复制等
要备份所有文件和存储库,请备份 .git 目录的父文件夹。
/myProject
/.git
/myproject.txt
备份 /myProject
将备份存储库和您的所有文件、已提交 更改和未提交 更改。
您的本地 git 存储库非常适合备份,因为它是完整的 git 存储库。您可以随时使用它来为其他人恢复您的 git 存储库!
只需将 .git
- 目录复制到另一个地方。但请注意:它可能很大!
我的本地 GIT 存储库在哪里?如果以后需要到同一台计算机或另一台计算机,我可以备份和恢复它吗?
更新:
抱歉,更清楚地说,我的 Mac 弹出一条消息,上面写着 "You haven't backed up in 12 days" 我想 "the only thing that has changed on my computer since then is the code in my project. I wonder if I can backup my local git repository to a USB drive and if anything happens I can restore it later if I need to, to another computer. Also, I haven't committed all of my changes."
Git 的 "repository" 存储在项目的隐藏 .git
文件夹中。您可以备份、恢复、复制等
要备份所有文件和存储库,请备份 .git 目录的父文件夹。
/myProject
/.git
/myproject.txt
备份 /myProject
将备份存储库和您的所有文件、已提交 更改和未提交 更改。
您的本地 git 存储库非常适合备份,因为它是完整的 git 存储库。您可以随时使用它来为其他人恢复您的 git 存储库!
只需将 .git
- 目录复制到另一个地方。但请注意:它可能很大!