git分支的完整备份

问题描述 投票:2回答:2

从一台PC上的本地git存储库备份完整分支的最佳方法是什么,目的是将其添加到另一台PC上的本地git存储库。

在远程git存储库服务器由于其结束失败而脱机的情况下。

git
2个回答
2
投票

首先,您可以制作当前仓库的本地克隆,including only your branch

git clone -b mybranch --single-branch /path/to/your/local/repo.git

然后你可以make a bundle of that repo,以便轻松保存它(一个包是一个Git仓库,压缩成一个文件)。

如果你有可能在某处访问bare empty repo(即使通过一个简单的共享文件夹),你可以简单地将你的分支推送到它。


0
投票
 git branch $(git rev-parse --abbrev-ref HEAD)--$(date "+%Y%m%d_%H%M")|git branch -a | grep -i $(git rev-parse --abbrev-ref HEAD)
© www.soinside.com 2019 - 2024. All rights reserved.