且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取裸仓库的工作副本

更新时间:2023-02-14 21:40:23

您可以简单地将资源库克隆到同一台计算机上的另一个目录中:

You can simply clone the repository to another directory on the same machine:

git clone /bare/repo/dir.git

当前目录将成为您的仓库的非纯粹克隆,并且您将自动收到 master 分支的结帐。然后使用像 git pull 这样的常用命令来根据需要更新它。

The current directory will become a non-bare clone of your repo, and you'll get a checkout of the master branch automatically. Then use the usual commands like git pull to update it as needed.

作为一个好处,这个操作是非常高效 - 如果你指定一个本地目录到 git clone ,git会尝试使用硬链接在这两个回购站之间共享对象。

As a side benefit, this operation is very efficient — if you specify a local directory to git clone, git will try to share objects between those two repos using hard links.