如何从Git导出所有更改/添加的文件? [英] How to export all changed/added files from Git?

查看:935
本文介绍了如何从Git导出所有更改/添加的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Git的新手,我有一个小问题.

I am very new to Git and I have a slight problem.

在SVN中,[em> [这感觉就像是阿尔伯特叔叔的唯一愚人节..在战争中..."] 当我想用我的最新更改来更新生产站点时,我会在TSVN中进行差异化处理,并导出两个修订版之间所有已更改/添加的文件.如您所料,将这些文件随后轻松地带到生产站点很容易.

In SVN [this feels like an Only Fools and Horses story by uncle Albert.."during the war..."] when I wanted to update a production site with my latest changes, I'd do a diff in TSVN and export all the changed/added files between two revisions. As you can imagine, it was easy to get those files to a production site afterwards.

但是,似乎我无法在Git中找到导出更改的文件"选项.我可以进行比较并查看更改,可以获取文件的列表,但实际上无法导出它们.有合理的方法可以做到这一点吗?我想念一些简单的东西吗?

However, it seems like I'm unable to find an "export changed files" option in Git. I can do a diff and see the changes, I can get a list of files, but I can't actually export them. Is there a reasonable way to do this? Am I missing something simple?

再次澄清一下,我需要导出所有两个特定提交之间的更改.

Just to clarify once again, I need to export all the changes between two specific commits.

提前谢谢!

推荐答案

如何导出它们?您说您已经有一个清单;您还想要什么?假设您使用git diff --name-only ...

How do you want to export them? You say you already have a list; what more do you want? Supposing you're getting your list with git diff --name-only ...

git archive --output=<file> HEAD $(git diff --name-only ...)

tar -czf <file> $(git diff --name-only ...)

cp $(git diff --name-only ...) <export-directory>

类似的东西吗?

或者您甚至可以使用diff本身-可以与git apply(我相信甚至是patch)一起使用.

Or you could even use the diff itself - it can be applied with git apply (or even patch, I believe).

这篇关于如何从Git导出所有更改/添加的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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