提取在git commit中更改的所有文件 [英] extract all files changed in a git commit

查看:267
本文介绍了提取在git commit中更改的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为某人制作补丁(他们不使用git) - 由提交更改的文件的zip。



我以为像

p>

git archive --format = zip commitguid> myfiles.zip



但是这会提取整个事物,而不仅仅是更改文件。有没有办法做到这一点?
为了让它变得更复杂 - 是否有任何方法可以做到这一点与多个提交(是的,我应该分支之前进行更改,但这是事后的看法)

编辑



基于@Amber解决方案,我可以在Git Bash中为安装在c:\data\progs中的7Zip的窗口执行两个步骤。

  git diff --name-only a-sha b-sha> tmp.txt 
/C/data/progs/7za.exe a myzip.zip @ tmp.txt


解决方案

  git diff --name-only< oldsha> < newsha> | zip dest.zip  -  @ 

填写适当的SHA / refs。例如,要创建仅在功能分支之间更改的文件的zip文件:

  git diff  - 仅限名称主功能| zip dest.zip  -  @ 


I need to make a patch for someone (they are not using git) - a zip of the files changed by a commit.

I thought something like

git archive --format=zip commitguid > myfiles.zip

but this extracts the entire thing, not just the changed files. Is there any way to do this? And to make it more complicated - is there any way of doing this with multiple commits (yes I should have branched before making the changes but that's hindsight)

EDIT

Based on @Amber solution below I can do this in 2 steps in Git Bash for windows with 7Zip installed in c:\data\progs.

git diff --name-only a-sha b-sha > tmp.txt
/C/data/progs/7za.exe a myzip.zip @tmp.txt

解决方案

git diff --name-only <oldsha> <newsha> | zip dest.zip -@

filling in the proper SHAs/refs. For instance, to create a zip of only the files that changed between the master and feature branches:

git diff --name-only master feature | zip dest.zip -@

这篇关于提取在git commit中更改的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆