git 如何提取已提交的文件,如何从Git仓库中提取任何提交到文件夹/归档的所有文件?...

本文介绍如何使用Git工作树功能,将不同版本(如v1.0和v2.0)的文件和目录分别保存到不同文件夹中,实现Git仓库历史的完整备份。通过git worktree 命令,可以在Windows环境下方便地为每个分支创建独立的文件夹结构。
摘要由CSDN通过智能技术生成

I have a Git Repository. I want to export all files and folders from my repository history, based on the different commits, into a folder. But I want to export all commits and branches separately. A sort of backup/archive for my git repository.

For example if I have a repository history of:

-v2.0 My Latest commit -v1.0 My Initial commit

I want to export all files and folders of these different commits into separate folders. I want the files as normal complete files not as a difference patch.

For example the folders "/MyGitBackup/Master/v1.0" and "/MyGitBackup/Master/v2.0" which should include the files of the according commits.

How can I achieve this? Is a GUI tool capable of this or something similar? I use a Windows machine.

解决方案

You can use git worktree that enables to checkout different commits to different directories.

So, execute the following commands in your working directory:

git worktree add /MyGitBackup/Master/v1.0

git worktree add /MyGitBackup/Master/v2.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值