我可以在服务器绑定模式下使用 git,而不在本地保留完整的历史记录吗?
Can I use git in a server-bound mode, without keeping the full history locally?
我在我的主要开发机器上使用 GIT,它有一个巨大的硬盘,我几乎没有注意到我有历史的完整副本。 (这是 GIT 的一大卖点,无需访问共享服务器即可离线工作。)
但是,我还有一台带有 Notepad++ 副本的平板电脑,剩余的可用空间不多 space。我也想在这里使用 GIT,但我没有足够的 space 来保留完整的历史记录。
我可以使用 GIT 的方式让我的本地存储只保留我当前的工作文件,而不是转到我的 GIT 服务器进行提交等吗?
我知道这是以我与该服务器断开连接时无法工作为代价的。
您可以使用 Git 浅层克隆。
https://www.perforce.com/blog/141218/git-beyond-basics-using-shallow-clones
git clone --depth 1 https://github.com/jquery/jquery.git jquery
The above command clones only the current HEAD of the jQuery repository on GitHub. An unscientific comparison shows that it completes in a couple of seconds compared to the roughly thirty-plus seconds it takes to clone the entire repository without the depth switch, a savings of more than 90%. That one trick can relieve a great deal of load from servers that are pulled frequently via automation.
Users should also be aware that shallow clones were quite limited in their functionality prior to Git v1.9. With v1.9 and later, however, Git has been improved to support pull and push operations even with shallow clones. This allows changes to be made and committed/pushed back to the source repository if needed as part of automated build operations.
我在我的主要开发机器上使用 GIT,它有一个巨大的硬盘,我几乎没有注意到我有历史的完整副本。 (这是 GIT 的一大卖点,无需访问共享服务器即可离线工作。)
但是,我还有一台带有 Notepad++ 副本的平板电脑,剩余的可用空间不多 space。我也想在这里使用 GIT,但我没有足够的 space 来保留完整的历史记录。
我可以使用 GIT 的方式让我的本地存储只保留我当前的工作文件,而不是转到我的 GIT 服务器进行提交等吗?
我知道这是以我与该服务器断开连接时无法工作为代价的。
您可以使用 Git 浅层克隆。
https://www.perforce.com/blog/141218/git-beyond-basics-using-shallow-clones
git clone --depth 1 https://github.com/jquery/jquery.git jquery
The above command clones only the current HEAD of the jQuery repository on GitHub. An unscientific comparison shows that it completes in a couple of seconds compared to the roughly thirty-plus seconds it takes to clone the entire repository without the depth switch, a savings of more than 90%. That one trick can relieve a great deal of load from servers that are pulled frequently via automation.
Users should also be aware that shallow clones were quite limited in their functionality prior to Git v1.9. With v1.9 and later, however, Git has been improved to support pull and push operations even with shallow clones. This allows changes to be made and committed/pushed back to the source repository if needed as part of automated build operations.