有时候咱们想导出某次版本提交时有哪些变动的文件,在 svn 中有一个 export 功能,很方便,以下图所示。git
在 Git 中我也找到了如下两种方法。微信
使用 git 自带命令 git archive
, 语法以下。svn
git archive -o c:/Users/yourusername/Desktop/export.zip NewCommitId $(git diff --name-only OldCommitId NewCommitId)
使用示例以下:code
git archive -o c:/Users/yourusername/Desktop/export.zip 479d554cf570edcc28c20ce264c6f216f8223bf3 $(git diff --name-only a838d0512e84e5eb42569cce3ef305d3ac1c44d0 479d554cf570edcc28c20ce264c6f216f8223bf3)
这样会在桌面生成一个 export.zip
压缩包。blog
这个方法须要敲命令,且每次拷贝先后提交的版本号,会稍显麻烦。教程
下载 TortoiseGit
Git 客户端软件,使用方法和 svn 的 export 功能相似。ip
很明显,方法2不用敲命令,不用拷贝提交版本号,方法2更方便,更实用!get
但遗憾的是,我没有在 Source Tree 软件中找到相似的功能,须要装两个客户端,有点蛋疼。若是你知道 Source Tree 中相似的导出变动文件功能,能够在下方留言。it
推荐:Spring Boot & Cloud 最强技术教程软件
扫描关注咱们的微信公众号,干货天天更新。