在git中创建一个包含特定文件的补丁 [英] Create a patch including specific files in git
本文介绍了在git中创建一个包含特定文件的补丁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
您可以限制 git diff $ c $通过在命令末尾列出路径(在
-
之后以避免路径名称和分支名称之间出现任何潜在的冲突)。例如,您可以执行以下操作:
git diff origin / master HEAD - app / models / region.rb doc / > changes.patch
...生成一个只显示特定文件和一个特定目录。
Let's say that I am 7 commits ahead of the origin/master repo. I would like to create a patch that includes in the patch specific files that were changed, not all the files. Or equivalent exclude specific files from the patch that were changed. How can I achieve that?
解决方案
You can restrict the output of git diff
by listing paths at the end of the command (after a --
to avoid any potential clashes between path names and branch names). For example, you could do the following:
git diff origin/master HEAD -- app/models/region.rb doc/ > changes.patch
... to generate a patch that only shows the differences within a particular file and a particular directory.
这篇关于在git中创建一个包含特定文件的补丁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文