在Git中只导出修改并添加的文件夹结构的文件 [英] Export only modified and added files with folder structure in Git
问题描述
我想在特定的提交中获取修改和添加的文件列表,以便我可以导出它们并生成一个包含文件结构的包。
想法是获取包并将其提取到服务器上。出于很多原因,我无法创建钩子来自动提取回购,并且我必须保持服务器更新的最简单方法是生成此包。
git diff-tree -r --no-commit-id --name -only --diff-filter = ACMRT $ commit_id
-
git diff-tree -r <$> $ commit_id
:
(包括所有子目录,而不仅仅是顶级目录)。
commit-id --name-only :
不输出提交SHA1。只输出受影响文件的名称而不是全差异。 仅在此提交中显示添加,复制,修改,重命名或其类型已更改的文件(例如文件→符号链接)。这留下了删除的文件。
I would like to get a list of modified and added files in an specific commit so that I can export them and generate a package with the file structure.
The idea is to get the package and extract it on the server. For many reasons I can't create a hook to pull the repo automatically and the easiest way I have to keep the server updated is generating this package.
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commit_id
git diff-tree -r $commit_id
:Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory).
--no-commit-id --name-only
:Do not output the commit SHA1. Output only the names of the affected files instead of a full diff.
--diff-filter=ACMRT
:Only show files added, copied, modified, renamed or that had their type changed (eg. file → symlink) in this commit. This leaves out deleted files.
这篇关于在Git中只导出修改并添加的文件夹结构的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!